1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 14:51:16 +02:00

call-flake.nix: Fix relative path resolution

`parentNode.sourceInfo.outPath` does not include the subdir of the
parent flake, while `parentNode.outPath` does. So we need to use the
latter.
This commit is contained in:
Eelco Dolstra 2024-05-17 16:38:01 +02:00
parent b2be6fed86
commit 49f592dd99
2 changed files with 5 additions and 1 deletions

View file

@ -47,7 +47,7 @@ let
else if node.locked.type == "path" && builtins.substring 0 1 node.locked.path != "/" else if node.locked.type == "path" && builtins.substring 0 1 node.locked.path != "/"
then then
parentNode.sourceInfo // { parentNode.sourceInfo // {
outPath = parentNode.sourceInfo.outPath + ("/" + node.locked.path); outPath = parentNode.outPath + ("/" + node.locked.path);
} }
else else
# FIXME: remove obsolete node.info. # FIXME: remove obsolete node.info.

View file

@ -63,6 +63,10 @@ git -C $rootFlake add flake.nix sub2/flake.nix
[[ $(nix eval $subflake2#y) = 15 ]] [[ $(nix eval $subflake2#y) = 15 ]]
# Make sure that this still works after commiting the lock file.
git -C $rootFlake add sub2/flake.lock
[[ $(nix eval $subflake2#y) = 15 ]]
# Make sure there are no content locks for relative path flakes. # Make sure there are no content locks for relative path flakes.
(! grep "$TEST_ROOT" $subflake2/flake.lock) (! grep "$TEST_ROOT" $subflake2/flake.lock)
(! grep "$NIX_STORE_DIR" $subflake2/flake.lock) (! grep "$NIX_STORE_DIR" $subflake2/flake.lock)