about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--corepkgs/unpack-channel.nix7
-rwxr-xr-xscripts/nix-channel.in4
2 files changed, 9 insertions, 2 deletions
diff --git a/corepkgs/unpack-channel.nix b/corepkgs/unpack-channel.nix
index 8cf79f8284..5c2a61e669 100644
--- a/corepkgs/unpack-channel.nix
+++ b/corepkgs/unpack-channel.nix
@@ -6,7 +6,12 @@ let
     ''
       mkdir $out
       cd $out
-      ${bzip2} -d < $src | ${tar} xf - ${tarFlags}
+      pat="\.xz\$"
+      if [[ "$src" =~ $pat ]]; then
+        ${xz} -d < $src | ${tar} xf - ${tarFlags}
+      else
+        ${bzip2} -d < $src | ${tar} xf - ${tarFlags}
+      fi
       mv * $out/$channelName
       if [ -n "$binaryCacheURL" ]; then
         mkdir $out/binary-caches
diff --git a/scripts/nix-channel.in b/scripts/nix-channel.in
index 7b292ee8cf..4a480ae28b 100755
--- a/scripts/nix-channel.in
+++ b/scripts/nix-channel.in
@@ -122,7 +122,9 @@ sub update {
         }
 
         # Download the channel tarball.
-        my $fullURL = "$url/nixexprs.tar.bz2";
+        my $fullURL = "$url/nixexprs.tar.xz";
+        system("$Nix::Config::curl --fail --silent --head '$fullURL' > /dev/null") == 0 or
+            $fullURL = "$url/nixexprs.tar.bz2";
         print STDERR "downloading Nix expressions from `$fullURL'...\n";
         my ($hash, $path) = `PRINT_PATH=1 QUIET=1 $Nix::Config::binDir/nix-prefetch-url '$fullURL'`;
         die "cannot fetch `$fullURL'\n" if $? != 0;