Skip to content

Commit 37ac18d

Browse files
committed
tests/flake-in-submodule: git+file:./* input
1 parent 9d088fa commit 37ac18d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/functional/flakes/flake-in-submodule.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,21 @@ git -C "$rootRepo" commit -m "Add flake.nix"
7676

7777
storePath=$(nix flake metadata --json "$rootRepo?submodules=1" | jq -r .path)
7878
[[ -e "$storePath/submodule" ]]
79+
80+
# The root repo may use the submodule repo as an input
81+
# through the relative path. This may change in the future;
82+
# see: https://discourse.nixos.org/t/57783 and #9708.
83+
cat > "$rootRepo"/flake.nix <<EOF
84+
{
85+
inputs.subRepo.url = "git+file:./submodule";
86+
outputs = { ... }: { };
87+
}
88+
EOF
89+
git -C "$rootRepo" add flake.nix
90+
git -C "$rootRepo" commit -m "Add subRepo input"
91+
(
92+
cd "$rootRepo"
93+
# The submodule must be locked to the relative path,
94+
# _not_ the absolute path:
95+
[[ $(nix flake metadata --json | jq -r .locks.nodes.subRepo.locked.url) = "file:./submodule" ]]
96+
)

0 commit comments

Comments
 (0)