diff --git a/pkgs/development/go-modules/tools/setup-hook.sh b/pkgs/development/go-modules/tools/setup-hook.sh new file mode 100644 index 000000000000..e354e50c35aa --- /dev/null +++ b/pkgs/development/go-modules/tools/setup-hook.sh @@ -0,0 +1 @@ +export GOTOOLDIR=@bin@/bin diff --git a/pkgs/top-level/go-packages.nix b/pkgs/top-level/go-packages.nix index f344de0f6892..55c8baac353d 100644 --- a/pkgs/top-level/go-packages.nix +++ b/pkgs/top-level/go-packages.nix @@ -133,6 +133,14 @@ let # Do not copy this without a good reason for enabling # In this case tools is heavily coupled with go itself and embeds paths. allowGoReference = true; + + # Set GOTOOLDIR for derivations adding this to buildInputs + postInstall = '' + mkdir -p $bin/nix-support + substituteAll ${../development/go-modules/tools/setup-hook.sh} $bin/nix-support/setup-hook.tmp + cat $bin/nix-support/setup-hook.tmp >> $bin/nix-support/setup-hook + rm $bin/nix-support/setup-hook.tmp + ''; };