From 72890726f377d2d12cdd27318f6decb27e092f47 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Wed, 15 Feb 2023 14:31:29 +0800 Subject: [PATCH 1/2] fix cross compiling select go compiler in `buildPackages` instead of `pkgs` --- builder/default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/builder/default.nix b/builder/default.nix index 42c95c7..6d93a63 100644 --- a/builder/default.nix +++ b/builder/default.nix @@ -8,6 +8,7 @@ , cacert , pkgs , pkgsBuildBuild +, buildPackages , runtimeShell , writeScript , gomod2nix @@ -127,20 +128,20 @@ let ); # Return a Go attribute and error out if the Go version is older than was specified in go.mod. - selectGo = attrs: goMod: attrs.go or (if goMod == null then pkgs.go else + selectGo = attrs: goMod: attrs.go or (if goMod == null then buildPackages.go else ( let goVersion = goMod.go; goAttrs = lib.reverseList (builtins.filter ( - attr: lib.hasPrefix "go_" attr && lib.versionAtLeast pkgs.${attr}.version goVersion + attr: lib.hasPrefix "go_" attr && lib.versionAtLeast buildPackages.${attr}.version goVersion ) - (lib.attrNames pkgs)); + (lib.attrNames buildPackages)); goAttr = elemAt goAttrs 0; in ( if goAttrs != [ ] - then pkgs.${goAttr} + then buildPackages.${goAttr} else throw "go.mod specified Go version ${goVersion}, but no compatible Go attribute could be found." ) )); From 23aaa89f106df36f72cbfe055a0844eb6d17a9fe Mon Sep 17 00:00:00 2001 From: HuangYi Date: Wed, 15 Feb 2023 16:51:18 +0800 Subject: [PATCH 2/2] we actually support more platforms than go.meta.platforms because of cross-compiling --- builder/default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builder/default.nix b/builder/default.nix index 6d93a63..e16c0c0 100644 --- a/builder/default.nix +++ b/builder/default.nix @@ -6,7 +6,6 @@ , fetchgit , jq , cacert -, pkgs , pkgsBuildBuild , buildPackages , runtimeShell @@ -431,7 +430,7 @@ let } // passthru; - meta = { platforms = go.meta.platforms or platforms.all; } // meta; + inherit meta; }); in