Skip to content

Commit

Permalink
go: invoke bash directly on make.bash
Browse files Browse the repository at this point in the history
This change invokes bash interpreter directly on make.bash script.
This allows using overrideAttrs with dontPatch set to true (but also
doCheck set to false for Go 1.17) as a workaround for issue NixOS#125198.

	pkgs.go.overrideAttrs (prev: { dontPatch = true; })

	pkgs.go_1_19.overrideAttrs (prev: { dontPatch = true; })

	pkgs.go_1_18.overrideAttrs (prev: { dontPatch = true; })

	pkgs.go_1_17.overrideAttrs (prev: {
	  dontPatch = true;
	  doCheck = false;
	})
  • Loading branch information
tie committed Sep 29, 2022
1 parent dbed7c2 commit 67fb3a6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion pkgs/development/compilers/go/1.17.nix
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,12 @@ stdenv.mkDerivation rec {
'';

postBuild = ''
(cd src && ./make.bash)
# Invoke the bash interpreter directly on make.bash script to allow using overrideAttrs with
# dontPatch set to true (disables postPatch that runs patchShebangs) and doCheck set to false
# (since Go test suite assumes that the environment is not sandboxed) as a workaround for
# https://github.com/NixOS/nixpkgs/issues/125198 until necessary changes are implemented in
# upstream Go source tree.
(cd src && bash make.bash)
'';

doCheck = stdenv.hostPlatform == stdenv.targetPlatform && !stdenv.isDarwin;
Expand Down
7 changes: 6 additions & 1 deletion pkgs/development/compilers/go/1.18.nix
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,14 @@ stdenv.mkDerivation rec {
''}
ulimit -a
# Invoke the bash interpreter directly on make.bash script to allow using overrideAttrs with
# dontPatch set to true (disables postPatch that runs patchShebangs) as a workaround for
# https://github.com/NixOS/nixpkgs/issues/125198 until necessary changes are implemented in
# upstream Go source tree.
pushd src
./make.bash
bash make.bash
popd
runHook postBuild
'';

Expand Down
7 changes: 6 additions & 1 deletion pkgs/development/compilers/go/1.19.nix
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,14 @@ stdenv.mkDerivation rec {
''}
ulimit -a
# Invoke the bash interpreter directly on make.bash script to allow using overrideAttrs with
# dontPatch set to true (disables postPatch that runs patchShebangs) as a workaround for
# https://github.com/NixOS/nixpkgs/issues/125198 until necessary changes are implemented in
# upstream Go source tree.
pushd src
./make.bash
bash make.bash
popd
runHook postBuild
'';

Expand Down

0 comments on commit 67fb3a6

Please sign in to comment.