mirror of
https://github.com/NixOS/nix
synced 2025-06-25 02:21:16 +02:00
Add a test for a flake referencing a flake that has inputs.self
This commit is contained in:
parent
25fcc8d1ab
commit
38f391444b
1 changed files with 28 additions and 0 deletions
|
@ -27,6 +27,7 @@ git config --global protocol.file.allow always
|
||||||
|
|
||||||
rootRepo=$TEST_ROOT/rootRepo
|
rootRepo=$TEST_ROOT/rootRepo
|
||||||
subRepo=$TEST_ROOT/submodule
|
subRepo=$TEST_ROOT/submodule
|
||||||
|
otherRepo=$TEST_ROOT/otherRepo
|
||||||
|
|
||||||
|
|
||||||
createGitRepo "$subRepo"
|
createGitRepo "$subRepo"
|
||||||
|
@ -91,6 +92,33 @@ git -C "$rootRepo" commit -a -m "Bla"
|
||||||
storePath=$(nix eval --raw "$rootRepo#foo")
|
storePath=$(nix eval --raw "$rootRepo#foo")
|
||||||
[[ -e "$storePath/submodule" ]]
|
[[ -e "$storePath/submodule" ]]
|
||||||
|
|
||||||
|
|
||||||
|
# Test another repo referring to a repo that uses inputs.self.
|
||||||
|
createGitRepo "$otherRepo"
|
||||||
|
cat > "$otherRepo"/flake.nix <<EOF
|
||||||
|
{
|
||||||
|
inputs.root.url = "git+file://$rootRepo";
|
||||||
|
outputs = { self, root }: {
|
||||||
|
foo = root.foo;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
git -C "$otherRepo" add flake.nix
|
||||||
|
|
||||||
|
# The first call should refetch the root repo...
|
||||||
|
expectStderr 0 nix eval --raw "$otherRepo#foo" -vvvvv | grepQuiet "refetching"
|
||||||
|
|
||||||
|
[[ $(jq .nodes.root_2.locked.submodules "$otherRepo/flake.lock") == true ]]
|
||||||
|
|
||||||
|
# ... but the second call should have 'submodules = true' in flake.lock, so it should not refetch.
|
||||||
|
rm -rf "$TEST_HOME/.cache"
|
||||||
|
clearStore
|
||||||
|
expectStderr 0 nix eval --raw "$otherRepo#foo" -vvvvv | grepQuietInverse "refetching"
|
||||||
|
|
||||||
|
storePath=$(nix eval --raw "$otherRepo#foo")
|
||||||
|
[[ -e "$storePath/submodule" ]]
|
||||||
|
|
||||||
|
|
||||||
# The root repo may use the submodule repo as an input
|
# The root repo may use the submodule repo as an input
|
||||||
# through the relative path. This may change in the future;
|
# through the relative path. This may change in the future;
|
||||||
# see: https://discourse.nixos.org/t/57783 and #9708.
|
# see: https://discourse.nixos.org/t/57783 and #9708.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue