forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / applications / version-management / sourcehut / fix-gqlgen-trimpath.nix
blob42ec1589a643c870451e3f448de5ca1f14486885
1 { unzip
2 , gqlgenVersion
3 }:
5   overrideModAttrs = (_: {
6     # No need to workaround -trimpath: it's not used in goModules,
7     # but do download `go generate`'s dependencies nonetheless.
8     preBuild = ''
9       if [ -d ./loaders ]; then go generate ./loaders; fi
10       if [ -d ./graph ]; then go generate ./graph; fi
11     '';
12   });
14   # Workaround this error:
15   #   go: git.sr.ht/~emersion/go-emailthreads@v0.0.0-20220412093310-4fd792e343ba: module lookup disabled by GOPROXY=off
16   #   tidy failed: go mod tidy failed: exit status 1
17   #   graph/generate.go:10: running "go": exit status 1
18   proxyVendor = true;
20   nativeBuildInputs = [ unzip ];
22   # Workaround -trimpath in the package derivation:
23   # https://github.com/99designs/gqlgen/issues/1537
24   # This is to give `go generate ./graph` access to gqlgen's *.gotpl files
25   # If it fails, the gqlgenVersion may have to be updated.
26   preBuild = ''
27     unzip ''${GOPROXY#"file://"}/github.com/99designs/gqlgen/@v/v${gqlgenVersion}.zip
28     if [ -d ./loaders ]; then go generate ./loaders; fi
29     if [ -d ./graph ]; then go generate ./graph; fi
30     rm -rf github.com
31   '';