Skip to content

Support relative path inputs#71

Merged
edolstra merged 5 commits intoNixOS:masterfrom
MattSturgeon:relative-path
Oct 27, 2025
Merged

Support relative path inputs#71
edolstra merged 5 commits intoNixOS:masterfrom
MattSturgeon:relative-path

Conversation

@MattSturgeon
Copy link
Contributor

@MattSturgeon MattSturgeon commented May 12, 2025

Cherry-pick the relative path inputs implementation from upstream nix.

Cherry-picked relevant patches from:

The only significant diff conflict were:

  1. flake-compat has no "overrides"
  2. flake-compat has additional logic for fetching the "root" node's source

This supersedes and closes #18

cc @edolstra @roberth @BBBSnowball

Copy link
Member

@roberth roberth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MattSturgeon

This comment was marked as off-topic.

@MattSturgeon

This comment was marked as outdated.

@MattSturgeon

This comment was marked as outdated.

edolstra and others added 5 commits May 19, 2025 23:14
This requires that we refer to the `sourceInfo` instead of the
`result`. However, `sourceInfo` does not create a chain of basedir
resolution, so we add that back with `flakeDir`.

(cherry picked from commit NixOS/nix@2109a5a)
(cherry picked from PR NixOS/nix#13026)
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.

(cherry picked from commit NixOS/nix@46beb9a)
(cherry picked from PR NixOS/nix#13170)
@MattSturgeon
Copy link
Contributor Author

With NixOS/nix#13164 fixed, I've updated this PR to include all the relevant patches, cherry picked from https://github.com/NixOS/nix.

@MattSturgeon

This comment has been minimized.

@MattSturgeon

This comment has been minimized.

@bryango
Copy link
Member

bryango commented Jul 12, 2025

@MattSturgeon Would you be interested in porting this to https://git.lix.systems/lix-project/flake-compat as well? Lix currently lacks an implementation for relative path inputs so this patch would be a valuable addition. Also, the fork contains some extra goodies such as an ad-hoc "lazy-trees" implementation 😜

@hukaidong
Copy link

This is important and looking forward to see it gets merged

@edolstra edolstra merged commit f387cd2 into NixOS:master Oct 27, 2025
@MattSturgeon MattSturgeon deleted the relative-path branch October 27, 2025 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants