Use correct parent outPath
for relative path inputs (backport #13170)
#13404
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Ensure relative path inputs are relative to the parent node's actual
outPath
, instead of the subtly differentsourceInfo.outPath
.Without this, nested relative-path inputs within the same repo end up repeating the parent's relative path segment:
Notice how
nestedFlake2
has/./nested-flake1//./nested-flake1/.
, repeatingnestedFlake1
's path.Context
Fixes Nested flake source paths broken #13164
Additional discussion in Support relative path inputs edolstra/flake-compat#71
cc @edolstra @roberth @packruler @meskill
Testing
I assume a test case would be beneficial, however I'm not familiar with your test suite. Feel free to take over this PR or cherry-pick the changes into a new PR if that is easier. Or if you have ideas for tests, I can try to implement them with some hand-holding 😀
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.
This is an automatic backport of pull request #13170 done by [Mergify](https://mergify.com).