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.
This commit is contained in:
William A. Kennington III
2015-08-29 12:55:52 -07:00
parent 0b4bcaad95
commit 83cf8b0cf8
6 changed files with 44 additions and 39 deletions

View File

@@ -129,19 +129,17 @@ go.stdenv.mkDerivation (
runHook preInstall
mkdir -p $out
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
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
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;