aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/flake-searching.sh24
-rw-r--r--tests/local.mk1
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 \