diff --git a/pkgs/by-name/di/direnv/package.nix b/pkgs/by-name/di/direnv/package.nix index 97f11d335be6..096de4eec6a5 100644 --- a/pkgs/by-name/di/direnv/package.nix +++ b/pkgs/by-name/di/direnv/package.nix @@ -28,6 +28,13 @@ buildGoModule (finalAttrs: { # Build a static executable to avoid environment runtime impurities env.CGO_ENABLED = 0; + # With CGO disabled the internal linker is used by default; remove the + # explicit -linkmode=external flag from the Makefile which is incompatible + # with CGO_ENABLED=0 (see https://github.com/NixOS/nixpkgs/pull/486452) + postPatch = '' + substituteInPlace GNUmakefile --replace-fail " -linkmode=external" "" + ''; + # replace the build phase to use the GNUMakefile instead buildPhase = '' make BASH_PATH=$BASH_PATH