From d404767bec6b7b3b3065cf284741b7dd43ad7aea Mon Sep 17 00:00:00 2001 From: adisbladis Date: Tue, 14 Jun 2022 05:25:21 +0800 Subject: [PATCH 1/2] builder: Build internal packages for host plattform --- builder/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builder/default.nix b/builder/default.nix index 5131fd3..e55d6c6 100644 --- a/builder/default.nix +++ b/builder/default.nix @@ -8,6 +8,7 @@ , jq , cacert , pkgs +, pkgsBuildBuild }: let @@ -18,9 +19,10 @@ let # Internal only build-time attributes internal = let - mkInternalPkg = name: src: pkgs.runCommand "gomod2nix-${name}" + mkInternalPkg = name: src: pkgsBuildBuild.runCommand "gomod2nix-${name}" { - nativeBuildInputs = [ pkgs.go ]; + inherit (pkgsBuildBuild.go) GOOS GOARCH; + nativeBuildInputs = [ pkgsBuildBuild.go ]; } '' export HOME=$(mktemp -d) cp ${src} src.go From f8646af3f290729bdc236cb35ca1a4bb6c2265fc Mon Sep 17 00:00:00 2001 From: adisbladis Date: Tue, 14 Jun 2022 05:26:36 +0800 Subject: [PATCH 2/2] gomod2nix: Only generate completions if we are not cross compiling --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 6d4a0bf..7c5e96d 100644 --- a/default.nix +++ b/default.nix @@ -20,7 +20,7 @@ buildGoApplication { nativeBuildInputs = [ makeWrapper installShellFiles ]; - postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.targetPlatform) '' + postInstall = lib.optionalString (stdenv.buildPlatform == stdenv.targetPlatform) '' $out/bin/gomod2nix completion bash > gomod2nix.bash $out/bin/gomod2nix completion fish > gomod2nix.fish $out/bin/gomod2nix completion zsh > _gomod2nix