1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 18:31:49 +02:00

<nix/fetchurl.nix>: Support xz-compressed NARs

This commit is contained in:
Eelco Dolstra 2015-10-30 12:33:40 +01:00
parent dae5dc7ade
commit 1f735a3440
7 changed files with 80 additions and 2 deletions

View file

@ -2,12 +2,14 @@ source common.sh
clearStore
# Test fetching a flat file.
hash=$(nix-hash --flat --type sha256 ./fetchurl.sh)
outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$(pwd)/fetchurl.sh --argstr sha256 $hash --no-out-link)
cmp $outPath fetchurl.sh
# Test unpacking a NAR.
rm -rf $TEST_ROOT/archive
mkdir -p $TEST_ROOT/archive
cp ./fetchurl.sh $TEST_ROOT/archive
@ -25,3 +27,15 @@ echo $outPath | grep -q 'xyzzy'
test -x $outPath/fetchurl.sh
test -L $outPath/symlink
nix-store --delete $outPath
# Test unpacking a compressed NAR.
narxz=$TEST_ROOT/archive.nar.xz
rm -f $narxz
xz --keep $nar
outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$narxz --argstr sha256 $hash \
--arg unpack true --argstr name xyzzy --no-out-link)
test -x $outPath/fetchurl.sh
test -L $outPath/symlink