8edd3e2105
This extends the current script to pull the gqlgen version from the go.mod file in the repository root (which we check out already anyway) and replace it as necessary. Makes updating all packages _a lot_ less painful. And since this is now automated, remove the default value we previously defined for `gqlgenVersion`. Signed-off-by: Christoph Heiss <christoph@c8h4.io>
33 lines
1007 B
Nix
33 lines
1007 B
Nix
{ unzip
|
|
, gqlgenVersion
|
|
}:
|
|
{
|
|
overrideModAttrs = (_: {
|
|
# No need to workaround -trimpath: it's not used in goModules,
|
|
# but do download `go generate`'s dependencies nonetheless.
|
|
preBuild = ''
|
|
go generate ./loaders
|
|
go generate ./graph
|
|
'';
|
|
});
|
|
|
|
# Workaround this error:
|
|
# 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;
|
|
|
|
nativeBuildInputs = [ unzip ];
|
|
|
|
# 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 = ''
|
|
unzip ''${GOPROXY#"file://"}/github.com/99designs/gqlgen/@v/v${gqlgenVersion}.zip
|
|
go generate ./loaders
|
|
go generate ./graph
|
|
rm -rf github.com
|
|
'';
|
|
}
|