From 5116214343ecce70a3cb7037f223313314a0a614 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 1 Jul 2013 21:02:36 +0200 Subject: Add support for uncompressed NARs in binary caches Issue NixOS/hydra#102. --- corepkgs/nar.nix | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'corepkgs') diff --git a/corepkgs/nar.nix b/corepkgs/nar.nix index fc9687af77..73009047ec 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 -- cgit 1.4.1