dae5dc7ade
This removes the need to have multiple downloads in the stdenv bootstrap process (like a separate busybox binary for Linux, or curl/mkdir/sh/bzip2 for Darwin). Now all those files can be combined into a single NAR.
27 lines
750 B
Bash
27 lines
750 B
Bash
source common.sh
|
|
|
|
clearStore
|
|
|
|
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
|
|
|
|
rm -rf $TEST_ROOT/archive
|
|
mkdir -p $TEST_ROOT/archive
|
|
cp ./fetchurl.sh $TEST_ROOT/archive
|
|
chmod +x $TEST_ROOT/archive/fetchurl.sh
|
|
ln -s foo $TEST_ROOT/archive/symlink
|
|
nar=$TEST_ROOT/archive.nar
|
|
nix-store --dump $TEST_ROOT/archive > $nar
|
|
|
|
hash=$(nix-hash --flat --type sha256 $nar)
|
|
|
|
outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$nar --argstr sha256 $hash \
|
|
--arg unpack true --argstr name xyzzy --no-out-link)
|
|
|
|
echo $outPath | grep -q 'xyzzy'
|
|
|
|
test -x $outPath/fetchurl.sh
|
|
test -L $outPath/symlink
|