mirror of
https://github.com/NixOS/nix
synced 2025-07-10 00:33:55 +02:00
Split off the circular flake import tests
This commit is contained in:
parent
c591efafd3
commit
f011c269c9
4 changed files with 74 additions and 61 deletions
49
tests/flakes/circular.sh
Normal file
49
tests/flakes/circular.sh
Normal file
|
@ -0,0 +1,49 @@
|
|||
# Test circular flake dependencies.
|
||||
source ./common.sh
|
||||
|
||||
requireGit
|
||||
|
||||
flakeA=$TEST_ROOT/flakeA
|
||||
flakeB=$TEST_ROOT/flakeB
|
||||
|
||||
createGitRepo $flakeA
|
||||
createGitRepo $flakeB
|
||||
|
||||
cat > $flakeA/flake.nix <<EOF
|
||||
{
|
||||
inputs.b.url = git+file://$flakeB;
|
||||
inputs.b.inputs.a.follows = "/";
|
||||
|
||||
outputs = { self, b }: {
|
||||
foo = 123 + b.bar;
|
||||
xyzzy = 1000;
|
||||
};
|
||||
}
|
||||
EOF
|
||||
|
||||
git -C $flakeA add flake.nix
|
||||
|
||||
cat > $flakeB/flake.nix <<EOF
|
||||
{
|
||||
inputs.a.url = git+file://$flakeA;
|
||||
|
||||
outputs = { self, a }: {
|
||||
bar = 456 + a.xyzzy;
|
||||
};
|
||||
}
|
||||
EOF
|
||||
|
||||
git -C $flakeB add flake.nix
|
||||
git -C $flakeB commit -a -m 'Foo'
|
||||
|
||||
[[ $(nix eval $flakeA#foo) = 1579 ]]
|
||||
[[ $(nix eval $flakeA#foo) = 1579 ]]
|
||||
|
||||
sed -i $flakeB/flake.nix -e 's/456/789/'
|
||||
git -C $flakeB commit -a -m 'Foo'
|
||||
|
||||
[[ $(nix eval --update-input b $flakeA#foo) = 1912 ]]
|
||||
|
||||
# Test list-inputs with circular dependencies
|
||||
nix flake metadata $flakeA
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue