aboutsummaryrefslogtreecommitdiff
path: root/tests/tarball.sh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-02-11 23:53:46 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-02-11 23:53:46 +0100
commit26dacc09837cb5226b7d97ed70a0fbade5e40304 (patch)
tree1bc71e89ec68c62b1e83ddd8c468cbdd69ed41b5 /tests/tarball.sh
parentd4df99a3349cf2228a8ee78dea320afef86eb3ba (diff)
Add fetchTree builtin function
This allows all supported fetchers to be used, e.g. builtins.fetchTree { type = "github"; owner = "NixOS"; repo = "nix"; rev = "d4df99a3349cf2228a8ee78dea320afef86eb3ba"; }
Diffstat (limited to 'tests/tarball.sh')
-rw-r--r--tests/tarball.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/tarball.sh b/tests/tarball.sh
index 8adb8d72f..7c8896b2e 100644
--- a/tests/tarball.sh
+++ b/tests/tarball.sh
@@ -10,6 +10,8 @@ mkdir -p $tarroot
cp dependencies.nix $tarroot/default.nix
cp config.nix dependencies.builder*.sh $tarroot/
+hash=$(nix hash-path $tarroot)
+
test_tarball() {
local ext="$1"
local compressor="$2"
@@ -25,6 +27,10 @@ test_tarball() {
nix-build -o $TEST_ROOT/result -E "import (fetchTarball file://$tarball)"
+ nix-build -o $TEST_ROOT/result -E "import (fetchTree file://$tarball)"
+ nix-build -o $TEST_ROOT/result -E "import (fetchTree { type = \"tarball\"; url = file://$tarball; })"
+ nix-build -o $TEST_ROOT/result -E "import (fetchTree { type = \"tarball\"; url = file://$tarball; narHash = \"$hash\"; })"
+
nix-instantiate --eval -E '1 + 2' -I fnord=file://no-such-tarball.tar$ext
nix-instantiate --eval -E 'with <fnord/xyzzy>; 1 + 2' -I fnord=file://no-such-tarball$ext
(! nix-instantiate --eval -E '<fnord/xyzzy> 1' -I fnord=file://no-such-tarball$ext)