diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-07-01T19·02+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-07-01T19·03+0200 |
commit | 5116214343ecce70a3cb7037f223313314a0a614 (patch) | |
tree | fe35411b06a074849b0cb538e4c5a9fc425346a4 /corepkgs/nar.nix | |
parent | 798671163254d9766f711f4e8101bc72bcf4bd5c (diff) |
Add support for uncompressed NARs in binary caches
Issue NixOS/hydra#102.
Diffstat (limited to 'corepkgs/nar.nix')
-rw-r--r-- | corepkgs/nar.nix | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/corepkgs/nar.nix b/corepkgs/nar.nix index fc9687af776c..73009047ec08 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 |