diff options
author | Julien Moutinho <julm+nixpkgs@sourcephile.fr> | 2022-05-11 22:07:34 +0200 |
---|---|---|
committer | tomberek <tomberek@users.noreply.github.com> | 2022-06-08 19:46:04 -0400 |
commit | a0021846c278a8dbf54d5855dcaa7e4d75e6c5f7 (patch) | |
tree | c0275159fa2bcdf8c86fdedf5c9aede0711c9d66 /pkgs/applications/version-management/sourcehut/fix-gqlgen-trimpath.nix | |
parent | 0e51dce7781574bbe5c99f649ae8bf157c268d76 (diff) |
sourcehut: fix gqlgen with -trimpath
Diffstat (limited to 'pkgs/applications/version-management/sourcehut/fix-gqlgen-trimpath.nix')
-rw-r--r-- | pkgs/applications/version-management/sourcehut/fix-gqlgen-trimpath.nix | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/pkgs/applications/version-management/sourcehut/fix-gqlgen-trimpath.nix b/pkgs/applications/version-management/sourcehut/fix-gqlgen-trimpath.nix new file mode 100644 index 0000000000000..1f94913292e03 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/fix-gqlgen-trimpath.nix @@ -0,0 +1,32 @@ +{ unzip }: +{ + overrideModAttrs = (_: { + # No need to workaround -trimpath: it's not used in go-modules, + # but do download `go generate`'s dependencies nonetheless. + preBuild = '' + set -x + go generate ./loaders + go generate ./graph + set +x + ''; + }); + + # Workaround: + # go: git.sr.ht/~emersion/go-emailthreads@v0.0.0-20220412093310-4fd792e343ba: module lookup disabled by GOPROXY=off + # tidy failed: go mod tidy failed: exit status 1 + # graph/generate.go:10: running "go": exit status 1 + proxyVendor = true; + + # Workaround -trimpath in the package derivation: + # https://github.com/99designs/gqlgen/issues/1537 + # This is to give `go generate ./graph` access to gqlgen's *.gotpl files + # If it fails, the gqlgenVersion may have to be updated. + preBuild = let gqlgenVersion = "0.17.2"; in '' + set -x + ${unzip}/bin/unzip ''${GOPROXY#"file://"}/github.com/99designs/gqlgen/@v/v${gqlgenVersion}.zip + go generate ./loaders + go generate ./graph + rm -rf github.com + set +x + ''; +} |