From 86cd7e0948fd14e1a0dc3356132d666c60fc2bbd Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sun, 2 Jul 2023 11:26:43 +1000 Subject: [PATCH] buildGo{Module,Package}: set GOTOOLCHAIN to local prevent go from downloading another toolchain --- pkgs/build-support/go/module.nix | 5 +++-- pkgs/build-support/go/package.nix | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/go/module.nix b/pkgs/build-support/go/module.nix index b27a22d6702b..09b43063fb96 100644 --- a/pkgs/build-support/go/module.nix +++ b/pkgs/build-support/go/module.nix @@ -53,6 +53,7 @@ let args = removeAttrs args' [ "overrideModAttrs" "vendorSha256" "vendorHash" ]; GO111MODULE = "on"; + GOTOOLCHAIN = "local"; goModules = if (vendorHash == null) then "" else (stdenv.mkDerivation { @@ -62,7 +63,7 @@ let inherit (args) src; inherit (go) GOOS GOARCH; - inherit GO111MODULE; + inherit GO111MODULE GOTOOLCHAIN; # 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 @@ -151,7 +152,7 @@ let inherit (go) GOOS GOARCH; GOFLAGS = lib.optionals (!proxyVendor) [ "-mod=vendor" ] ++ lib.optionals (!allowGoReference) [ "-trimpath" ]; - inherit CGO_ENABLED enableParallelBuilding GO111MODULE; + inherit CGO_ENABLED enableParallelBuilding GO111MODULE GOTOOLCHAIN; configurePhase = args.configurePhase or ('' runHook preConfigure diff --git a/pkgs/build-support/go/package.nix b/pkgs/build-support/go/package.nix index b4cb264d9f24..7e099b76f0b7 100644 --- a/pkgs/build-support/go/package.nix +++ b/pkgs/build-support/go/package.nix @@ -86,6 +86,7 @@ let inherit CGO_ENABLED enableParallelBuilding; GO111MODULE = "off"; + GOTOOLCHAIN = "local"; GOFLAGS = lib.optionals (!allowGoReference) [ "-trimpath" ]; GOARM = toString (lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]);