mirror of
https://github.com/tweag/gomod2nix.git
synced 2024-11-09 12:09:08 +00:00
fix cross compiling
select go compiler in `buildPackages` instead of `pkgs`
This commit is contained in:
parent
89cd0675b9
commit
72890726f3
1 changed files with 5 additions and 4 deletions
|
@ -8,6 +8,7 @@
|
||||||
, cacert
|
, cacert
|
||||||
, pkgs
|
, pkgs
|
||||||
, pkgsBuildBuild
|
, pkgsBuildBuild
|
||||||
|
, buildPackages
|
||||||
, runtimeShell
|
, runtimeShell
|
||||||
, writeScript
|
, writeScript
|
||||||
, gomod2nix
|
, 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.
|
# 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
|
let
|
||||||
goVersion = goMod.go;
|
goVersion = goMod.go;
|
||||||
goAttrs = lib.reverseList (builtins.filter
|
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;
|
goAttr = elemAt goAttrs 0;
|
||||||
in
|
in
|
||||||
(
|
(
|
||||||
if goAttrs != [ ]
|
if goAttrs != [ ]
|
||||||
then pkgs.${goAttr}
|
then buildPackages.${goAttr}
|
||||||
else throw "go.mod specified Go version ${goVersion}, but no compatible Go attribute could be found."
|
else throw "go.mod specified Go version ${goVersion}, but no compatible Go attribute could be found."
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in a new issue