diff options
Diffstat (limited to 'tests/fetchTree-file.sh')
-rw-r--r-- | tests/fetchTree-file.sh | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/fetchTree-file.sh b/tests/fetchTree-file.sh index fe569cfb8..6395c133d 100644 --- a/tests/fetchTree-file.sh +++ b/tests/fetchTree-file.sh @@ -27,6 +27,7 @@ test_file_flake_input () { mkdir inputs echo foo > inputs/test_input_file + echo '{ outputs = { self }: { }; }' > inputs/flake.nix tar cfa test_input.tar.gz inputs cp test_input.tar.gz test_input_no_ext input_tarball_hash="$(nix hash path test_input.tar.gz)" @@ -50,6 +51,9 @@ test_file_flake_input () { url = "file+file://$PWD/test_input.tar.gz"; flake = false; }; + inputs.flake_no_ext = { + url = "file://$PWD/test_input_no_ext"; + }; outputs = { ... }: {}; } EOF @@ -58,7 +62,7 @@ EOF nix eval --file - <<EOF with (builtins.fromJSON (builtins.readFile ./flake.lock)); - # Url inputs whose extension doesn’t match a known archive format should + # Non-flake inputs whose extension doesn’t match a known archive format should # not be unpacked by default assert (nodes.no_ext_default_no_unpack.locked.type == "file"); assert (nodes.no_ext_default_no_unpack.locked.unpack or false == false); @@ -75,8 +79,16 @@ EOF # Explicitely passing the unpack parameter should enforce the desired behavior assert (nodes.no_ext_explicit_unpack.locked.narHash == nodes.tarball_default_unpack.locked.narHash); assert (nodes.tarball_explicit_no_unpack.locked.narHash == nodes.no_ext_default_no_unpack.locked.narHash); + + # Flake inputs should always be tarballs + assert (nodes.flake_no_ext.locked.type == "tarball"); + true EOF + + # Test tarball URLs on the command line. + [[ $(nix flake metadata --json file://$PWD/test_input_no_ext | jq -r .resolved.type) = tarball ]] + popd [[ -z "${NIX_DAEMON_PACKAGE-}" ]] && return 0 |