mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Merge pull request #12287 from bryango/2.24-maintenance
Backport git+file:./ fixes to 2.24 (#12107 + #12277)
This commit is contained in:
commit
f22359ba1a
10 changed files with 58 additions and 12 deletions
|
@ -63,3 +63,21 @@ flakeref=git+file://$rootRepo\?submodules=1\&dir=submodule
|
|||
echo '"foo"' > "$rootRepo"/submodule/sub.nix
|
||||
[[ $(nix eval --json "$flakeref#sub" ) = '"foo"' ]]
|
||||
[[ $(nix flake metadata --json "$flakeref" | jq -r .locked.rev) = null ]]
|
||||
|
||||
# The root repo may use the submodule repo as an input
|
||||
# through the relative path. This may change in the future;
|
||||
# see: https://discourse.nixos.org/t/57783 and #9708.
|
||||
cat > "$rootRepo"/flake.nix <<EOF
|
||||
{
|
||||
inputs.subRepo.url = "git+file:./submodule";
|
||||
outputs = { ... }: { };
|
||||
}
|
||||
EOF
|
||||
git -C "$rootRepo" add flake.nix
|
||||
git -C "$rootRepo" commit -m "Add subRepo input"
|
||||
(
|
||||
cd "$rootRepo"
|
||||
# The submodule must be locked to the relative path,
|
||||
# _not_ the absolute path:
|
||||
[[ $(nix flake metadata --json | jq -r .locks.nodes.subRepo.locked.url) = "file:./submodule" ]]
|
||||
)
|
||||
|
|
|
@ -228,6 +228,15 @@ nix build -o "$TEST_ROOT/result" "git+file://$flake1Dir#default"
|
|||
nix build -o "$TEST_ROOT/result" "$flake1Dir?ref=HEAD#default"
|
||||
nix build -o "$TEST_ROOT/result" "git+file://$flake1Dir?ref=HEAD#default"
|
||||
|
||||
# Check that relative paths are allowed for git flakes.
|
||||
# This may change in the future once git submodule support is refined.
|
||||
# See: https://discourse.nixos.org/t/57783 and #9708.
|
||||
(
|
||||
# This `cd` should not be required and is indicative of aforementioned bug.
|
||||
cd "$flake1Dir/.."
|
||||
nix build -o "$TEST_ROOT/result" "git+file:./$(basename "$flake1Dir")"
|
||||
)
|
||||
|
||||
# Check that store symlinks inside a flake are not interpreted as flakes.
|
||||
nix build -o "$flake1Dir/result" "git+file://$flake1Dir"
|
||||
nix path-info "$flake1Dir/result"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue