about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/download-using-manifests.pl.in10
-rwxr-xr-xscripts/nix-push.in1
2 files changed, 9 insertions, 2 deletions
diff --git a/scripts/download-using-manifests.pl.in b/scripts/download-using-manifests.pl.in
index 24f7c98e0cb9..7a76076d7a80 100755
--- a/scripts/download-using-manifests.pl.in
+++ b/scripts/download-using-manifests.pl.in
@@ -339,13 +339,19 @@ while (scalar @path > 0) {
         print LOGFILE "$$ narfile $narFile->{url} $size $v\n";
 
         Nix::Utils::checkURL $narFile->{url};
+
+        my $decompressor =
+            $narFile->{compressionType} eq "bzip2" ? "$Nix::Config::bzip2 -d" :
+            $narFile->{compressionType} eq "xz" ? "$Nix::Config::xz -d" :
+            die "unknown compression type `$narFile->{compressionType}'";
+
         if ($curStep < $maxStep) {
             # The archive will be used a base to a patch.
-            system("$curl '$narFile->{url}' | $Nix::Config::bzip2 -d > $tmpNar") == 0
+            system("$curl '$narFile->{url}' | $decompressor > $tmpNar") == 0
                 or die "cannot download and unpack `$narFile->{url}' into `$v'\n";
         } else {
             # Unpack the archive into the target path.
-            system("$curl '$narFile->{url}' | $Nix::Config::bzip2 -d | $Nix::Config::binDir/nix-store --restore '$v'") == 0
+            system("$curl '$narFile->{url}' | $decompressor | $Nix::Config::binDir/nix-store --restore '$v'") == 0
                 or die "cannot download and unpack `$narFile->{url}' into `$v'\n";
         }
 
diff --git a/scripts/nix-push.in b/scripts/nix-push.in
index 1edd8e77314b..00d03c3c1f0c 100755
--- a/scripts/nix-push.in
+++ b/scripts/nix-push.in
@@ -227,6 +227,7 @@ for (my $n = 0; $n < scalar @storePaths; $n++) {
         { url => "$archivesURL/$narName"
         , hash => "sha256:$compressedHash"
         , size => $compressedSize
+        , compressionType => $compressionType
         , narHash => "$narHash"
         , narSize => $narSize
         , references => join(" ", @{$refs})