From 6a27d63a882d1daecd1dce9e61135ccea3b0696e Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Fri, 21 Jun 2019 15:33:37 +0800 Subject: [PATCH] buildGoPackage: enable cross compilation --- pkgs/development/go-packages/generic/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/development/go-packages/generic/default.nix b/pkgs/development/go-packages/generic/default.nix index 8e016fadface..b3386aaf24bf 100644 --- a/pkgs/development/go-packages/generic/default.nix +++ b/pkgs/development/go-packages/generic/default.nix @@ -72,14 +72,19 @@ let goPath = if goDeps != null then importGodeps { depsFile = goDeps; } ++ extraSrcs else extraSrcs; - package = go.stdenv.mkDerivation ( + package = stdenv.mkDerivation ( (builtins.removeAttrs args [ "goPackageAliases" "disabled" "extraSrcs"]) // { nativeBuildInputs = [ removeReferencesTo go ] ++ (lib.optional (!dontRenameImports) govers) ++ nativeBuildInputs; buildInputs = buildInputs; - inherit (go) GOOS GOARCH; + inherit (go) GOOS GOARCH GO386 CGO_ENABLED; + + GOHOSTARCH = go.GOHOSTARCH or null; + GOHOSTOS = go.GOHOSTOS or null; + + GOARM = toString (stdenv.lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]); configurePhase = args.configurePhase or '' runHook preConfigure