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