Skip to content

Use correct parent outPath for relative path inputs (backport #13170)#13404

Merged
mergify[bot] merged 4 commits into2.29-maintenancefrom
mergify/bp/2.29-maintenance/pr-13170
Jun 27, 2025
Merged

Use correct parent outPath for relative path inputs (backport #13170)#13404
mergify[bot] merged 4 commits into2.29-maintenancefrom
mergify/bp/2.29-maintenance/pr-13170

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Jun 27, 2025

Motivation

Ensure relative path inputs are relative to the parent node's actual outPath, instead of the subtly different sourceInfo.outPath.

Without this, nested relative-path inputs within the same repo end up repeating the parent's relative path segment:

trace:
subdir for root:
flakeDir for root:
(no parent)
outPath for root: /nix/store/s4j8hchzds1x57hirv8y7p19nl44kqwr-source
sourceInfo.outPath for root: /nix/store/s4j8hchzds1x57hirv8y7p19nl44kqwr-source

trace:
subdir for nestedFlake1:
flakeDir for nestedFlake1: /./nested-flake1
parentNode.flakeDir for nestedFlake1:
outPath for nestedFlake1: /nix/store/s4j8hchzds1x57hirv8y7p19nl44kqwr-source//./nested-flake1
sourceInfo.outPath for nestedFlake1: /nix/store/s4j8hchzds1x57hirv8y7p19nl44kqwr-source//./nested-flake1

trace:
subdir for nestedFlake2:
flakeDir for nestedFlake2: /./nested-flake1/./nested-flake2
parentNode.flakeDir for nestedFlake2: /./nested-flake1
outPath for nestedFlake2: /nix/store/s4j8hchzds1x57hirv8y7p19nl44kqwr-source//./nested-flake1//./nested-flake1/./nested-flake2
sourceInfo.outPath for nestedFlake2: /nix/store/s4j8hchzds1x57hirv8y7p19nl44kqwr-source//./nested-flake1//./nested-flake1/./nested-flake2

Notice how nestedFlake2 has /./nested-flake1//./nested-flake1/., repeating nestedFlake1's path.

Context

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).

MattSturgeon and others added 4 commits June 27, 2025 11:59
Ensure relative path inputs are relative to the parent node's _actual_
`outPath`, instead of the subtly different `sourceInfo.outPath`.

Additionally, non-flake inputs now also have a `sourceInfo` attribute.

This fixes the relationship between `self.outPath` and
`self.sourceInfo.outPath` in some edge cases.

Fixes #13164

(cherry picked from commit 46beb9a)
@mergify mergify bot added automatic backport This PR is a backport produced by automation (does not trigger backporting) merge-queue labels Jun 27, 2025
@mergify mergify bot requested a review from edolstra as a code owner June 27, 2025 11:59
@github-actions github-actions bot added documentation with-tests Issues related to testing. PRs with tests have some priority labels Jun 27, 2025
@mergify mergify bot merged commit 8f6c5d0 into 2.29-maintenance Jun 27, 2025
27 checks passed
@mergify mergify bot deleted the mergify/bp/2.29-maintenance/pr-13170 branch June 27, 2025 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automatic backport This PR is a backport produced by automation (does not trigger backporting) documentation merge-queue with-tests Issues related to testing. PRs with tests have some priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants