summary refs log tree commit diff
path: root/pkgs/development/go-modules
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2015-08-29 12:55:52 -0700
committerWilliam A. Kennington III <william@wkennington.com>2015-08-29 12:58:03 -0700
commit83cf8b0cf89b2e3bb6a6ee9869f5cebc50563748 (patch)
treeb22fa9e634231c129b415c66c66f5fe573afa194 /pkgs/development/go-modules
parent0b4bcaad9519d6971f99356a778cd1cb369f6309 (diff)
downloadnixlib-83cf8b0cf89b2e3bb6a6ee9869f5cebc50563748.tar
nixlib-83cf8b0cf89b2e3bb6a6ee9869f5cebc50563748.tar.gz
nixlib-83cf8b0cf89b2e3bb6a6ee9869f5cebc50563748.tar.bz2
nixlib-83cf8b0cf89b2e3bb6a6ee9869f5cebc50563748.tar.lz
nixlib-83cf8b0cf89b2e3bb6a6ee9869f5cebc50563748.tar.xz
nixlib-83cf8b0cf89b2e3bb6a6ee9869f5cebc50563748.tar.zst
nixlib-83cf8b0cf89b2e3bb6a6ee9869f5cebc50563748.zip
goPackages: Split into multiple derivations
This should reduce the closure size for end users who only need go
binaries as well as reduce the size of closures hydra builders consume.
Diffstat (limited to 'pkgs/development/go-modules')
-rw-r--r--pkgs/development/go-modules/generic/default.nix27
1 files changed, 14 insertions, 13 deletions
diff --git a/pkgs/development/go-modules/generic/default.nix b/pkgs/development/go-modules/generic/default.nix
index 7842df6b58f8..de4f0803c34a 100644
--- a/pkgs/development/go-modules/generic/default.nix
+++ b/pkgs/development/go-modules/generic/default.nix
@@ -129,19 +129,17 @@ go.stdenv.mkDerivation (
     runHook preInstall
 
     mkdir -p $out
-
-    if [ -z "$dontInstallSrc" ]; then
-        pushd "$NIX_BUILD_TOP/go"
-        while read f; do
-          echo "$f" | grep -q '^./\(src\|pkg/[^/]*\)/${goPackagePath}' || continue
-          mkdir -p "$(dirname "$out/share/go/$f")"
-          cp "$NIX_BUILD_TOP/go/$f" "$out/share/go/$f"
-        done < <(find . -type f)
-        popd
-    fi
-
+    pushd "$NIX_BUILD_TOP/go"
+    while read f; do
+      echo "$f" | grep -q '^./\(src\|pkg/[^/]*\)/${goPackagePath}' || continue
+      mkdir -p "$(dirname "$out/share/go/$f")"
+      cp "$NIX_BUILD_TOP/go/$f" "$out/share/go/$f"
+    done < <(find . -type f)
+    popd
+
+    mkdir $bin
     dir="$NIX_BUILD_TOP/go/bin"
-    [ -e "$dir" ] && cp -r $dir $out
+    [ -e "$dir" ] && cp -r $dir $bin
 
     runHook postInstall
   '';
@@ -151,7 +149,7 @@ go.stdenv.mkDerivation (
       cat $file ${removeExpr removeReferences} > $file.tmp
       mv $file.tmp $file
       chmod +x $file
-    done < <(find $out/bin -type f 2>/dev/null)
+    done < <(find $bin/bin -type f 2>/dev/null)
   '';
 
   disallowedReferences = lib.optional (!allowGoReference) go
@@ -161,6 +159,9 @@ go.stdenv.mkDerivation (
 
   enableParallelBuilding = enableParallelBuilding;
 
+  # I prefer to call this dev but propagatedBuildInputs expects $out to exist
+  outputs = [ "out" "bin" ];
+
   meta = {
     # Add default meta information
     platforms = lib.platforms.all;