2
0
mirror of https://github.com/status-im/status-mobile.git synced 2025-01-18 20:51:49 +00:00

22 lines
661 B
Nix
Raw Normal View History

#
# Patch the Go compiler so that we can have a say (using a NIX_GOWORKDIR environment variable) as to the temporary directory it uses for linking,
# since that directory path ends up in the string table and .gnu.version_d ELF header
#
{ baseGo }:
let
go = baseGo.overrideDerivation(oldAttrs: {
postPatch = (oldAttrs.postPatch or "") + ''
substituteInPlace "src/cmd/go/internal/work/action.go" --replace \
'tmp, err := ioutil.TempDir(os.Getenv("GOTMPDIR"), "go-build")' \
'var err error
tmp := os.Getenv("NIX_GOWORKDIR")
if tmp == "" {
tmp, err = ioutil.TempDir(os.Getenv("GOTMPDIR"), "go-build")
}'
'';
});
in go