diff options
author | Tom Bereknyei <tomberek@gmail.com> | 2021-12-03 10:53:41 -0500 |
---|---|---|
committer | Tom Bereknyei <tomberek@gmail.com> | 2021-12-03 10:55:30 -0500 |
commit | b6cc0a704d8c1432e230ff65d4b74ea7114a730b (patch) | |
tree | 4e7ac9e3b2fd049fa8a605fd4495ea4de56c4332 /tests | |
parent | 2e606e87c44a8dc42664f8938eac1d4b63047dd6 (diff) |
flakes: search up to git or filesystem boundary
While parsing a flakeref, upon not finding a flake.nix, search upwards
until git or filesystem boundary.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/flake-searching.sh | 24 | ||||
-rw-r--r-- | tests/local.mk | 1 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/flake-searching.sh b/tests/flake-searching.sh new file mode 100644 index 000000000..82ae66894 --- /dev/null +++ b/tests/flake-searching.sh @@ -0,0 +1,24 @@ +source common.sh + +clearStore + +cp ./simple.nix ./simple.builder.sh ./config.nix $TEST_HOME +cd $TEST_HOME +cat <<EOF > flake.nix +{ + outputs = a: { + defaultPackage.$system = import ./simple.nix; + packages.$system.test = import ./simple.nix; + }; +} +EOF +mkdir subdir +cd subdir + +for i in "" . "$PWD" .# .#test; do + nix build $i || fail "flake should be found by searching up directories" +done + +for i in "path:$PWD"; do + ! nix build $i || fail "flake should not search up directories when using 'path:'" +done diff --git a/tests/local.mk b/tests/local.mk index 936b72c2a..9277c0b1b 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -47,6 +47,7 @@ nix_tests = \ describe-stores.sh \ flakes.sh \ flake-local-settings.sh \ + flake-searching.sh \ build.sh \ repl.sh ca/repl.sh \ ca/build.sh \ |