2022-07-13 18:16:39 +00:00
|
|
|
# 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
|
|
|
|
{
|
2024-08-10 13:12:26 +00:00
|
|
|
inputs.b.url = "git+file://$flakeB";
|
2022-07-13 18:16:39 +00:00
|
|
|
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
|
|
|
|
{
|
2024-08-10 13:12:26 +00:00
|
|
|
inputs.a.url = "git+file://$flakeA";
|
2022-07-13 18:16:39 +00:00
|
|
|
|
|
|
|
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'
|
|
|
|
|
2023-10-31 15:19:05 +00:00
|
|
|
nix flake update b --flake $flakeA
|
|
|
|
[[ $(nix eval $flakeA#foo) = 1912 ]]
|
2022-07-13 18:16:39 +00:00
|
|
|
|
|
|
|
# Test list-inputs with circular dependencies
|
|
|
|
nix flake metadata $flakeA
|