mirror of
https://github.com/NixOS/nix
synced 2025-07-08 02:43:54 +02:00
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.
This commit is contained in:
parent
2e606e87c4
commit
b6cc0a704d
4 changed files with 48 additions and 2 deletions
24
tests/flake-searching.sh
Normal file
24
tests/flake-searching.sh
Normal file
|
@ -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
|
|
@ -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 \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue