aboutsummaryrefslogtreecommitdiff
path: root/corepkgs/nar.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-07-01 21:02:36 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-07-01 21:03:14 +0200
commit5116214343ecce70a3cb7037f223313314a0a614 (patch)
treefe35411b06a074849b0cb538e4c5a9fc425346a4 /corepkgs/nar.nix
parent798671163254d9766f711f4e8101bc72bcf4bd5c (diff)
Add support for uncompressed NARs in binary caches
Issue NixOS/hydra#102.
Diffstat (limited to 'corepkgs/nar.nix')
-rw-r--r--corepkgs/nar.nix19
1 files changed, 11 insertions, 8 deletions
diff --git a/corepkgs/nar.nix b/corepkgs/nar.nix
index fc9687af7..73009047e 100644
--- a/corepkgs/nar.nix
+++ b/corepkgs/nar.nix
@@ -6,25 +6,28 @@ let
''
export PATH=${nixBinDir}:${coreutils}
- if [ $compressionType = "xz" ]; then
- ext=xz
- compressor="${xz} -9"
+ if [ $compressionType = xz ]; then
+ ext=.xz
+ compressor="| ${xz} -9"
+ elif [ $compressionType = bzip2 ]; then
+ ext=.bz2
+ compressor="| ${bzip2}"
else
- ext=bz2
- compressor="${bzip2}"
+ ext=
+ compressor=
fi
echo "packing ‘$storePath’..."
mkdir $out
- dst=$out/tmp.nar.$ext
+ dst=$out/tmp.nar$ext
set -o pipefail
- nix-store --dump "$storePath" | $compressor > $dst
+ eval "nix-store --dump \"$storePath\" $compressor > $dst"
hash=$(nix-hash --flat --type $hashAlgo --base32 $dst)
echo -n $hash > $out/nar-compressed-hash
- mv $dst $out/$hash.nar.$ext
+ mv $dst $out/$hash.nar$ext
'';
in