summary refs log tree commit diff
path: root/pkgs/build-support/go/module.nix
diff options
context:
space:
mode:
authorzowoq <59103226+zowoq@users.noreply.github.com>2023-07-02 11:25:47 +1000
committerzowoq <59103226+zowoq@users.noreply.github.com>2023-08-02 01:08:27 +1000
commit41ccfa322e0f2e6719f805c73384f9ae4f542107 (patch)
tree1b691a8ff6a839d295f7dc91d6d65edf3b32fb6c /pkgs/build-support/go/module.nix
parent9a424242d7db53b835e34dee4b8e8c20ec0bd3e5 (diff)
downloadnixpkgs-41ccfa322e0f2e6719f805c73384f9ae4f542107.tar
nixpkgs-41ccfa322e0f2e6719f805c73384f9ae4f542107.tar.gz
nixpkgs-41ccfa322e0f2e6719f805c73384f9ae4f542107.tar.bz2
nixpkgs-41ccfa322e0f2e6719f805c73384f9ae4f542107.tar.lz
nixpkgs-41ccfa322e0f2e6719f805c73384f9ae4f542107.tar.xz
nixpkgs-41ccfa322e0f2e6719f805c73384f9ae4f542107.tar.zst
nixpkgs-41ccfa322e0f2e6719f805c73384f9ae4f542107.zip
buildGoModule: refactor GO111MODULE
Diffstat (limited to 'pkgs/build-support/go/module.nix')
-rw-r--r--pkgs/build-support/go/module.nix8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkgs/build-support/go/module.nix b/pkgs/build-support/go/module.nix
index 6c2284a7a98..b27a22d6702 100644
--- a/pkgs/build-support/go/module.nix
+++ b/pkgs/build-support/go/module.nix
@@ -52,6 +52,8 @@ assert (args' ? vendorHash && args' ? vendorSha256) -> throw "both `vendorHash`
 let
   args = removeAttrs args' [ "overrideModAttrs" "vendorSha256" "vendorHash" ];
 
+  GO111MODULE = "on";
+
   goModules = if (vendorHash == null) then "" else
   (stdenv.mkDerivation {
     name = "${name}-go-modules";
@@ -60,6 +62,7 @@ let
 
     inherit (args) src;
     inherit (go) GOOS GOARCH;
+    inherit GO111MODULE;
 
     # The following inheritence behavior is not trivial to expect, and some may
     # argue it's not ideal. Changing it may break vendor hashes in Nixpkgs and
@@ -73,8 +76,6 @@ let
     postBuild = args.modPostBuild or "";
     sourceRoot = args.sourceRoot or "";
 
-    GO111MODULE = "on";
-
     impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
       "GIT_PROXY_COMMAND"
       "SOCKS_SERVER"
@@ -149,9 +150,8 @@ let
 
     inherit (go) GOOS GOARCH;
 
-    GO111MODULE = "on";
     GOFLAGS = lib.optionals (!proxyVendor) [ "-mod=vendor" ] ++ lib.optionals (!allowGoReference) [ "-trimpath" ];
-    inherit CGO_ENABLED enableParallelBuilding;
+    inherit CGO_ENABLED enableParallelBuilding GO111MODULE;
 
     configurePhase = args.configurePhase or (''
       runHook preConfigure