-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Relative git flake inputs git+file:relative/path #12281
Copy link
Copy link
Open
Labels
bugfeatureFeature request or proposalFeature request or proposalfetchingNetworking with the outside (non-Nix) world, input lockingNetworking with the outside (non-Nix) world, input lockingidea approvedThe given proposal has been discussed and approved by the Nix team. An implementation is welcome.The given proposal has been discussed and approved by the Nix team. An implementation is welcome.
Description
Is your feature request related to a problem?
-
- Nix currently resolves
git+file:relative/pathaccording to the process working directory instead of theflake.nixbase directory. This is unreliable. Evaluation should be invariant under the process working directory, or it would violate the ability to be used as a flake input, among other things. fetchTreedoes not have a base directory argument (and no implicit argument either, because that'd also be bad)
- Nix currently resolves
- Therefore
fetchTreedoes not have the information to resolve relative paths.
Solution for Flakes users
Users will be able to use a relative path reference since Nix 2.26 and they can enable submodules declaratively, planned for release in 2.27
{
# For Nix 2.27:
inputs.self.submodules = true;
# instead of: inputs.foo.url = "git+file://./my-submodule";
inputs.foo.url = ./my-submodule;
}For Nix 2.26, instead of inputs.self.submodules, use:
nix build .?submodules=true#my-package
Proposed solution (for fetchTree)
- Disallow git relative path inputs in
fetchTree - Either
- Resolve git relative path inputs in
call-flake.nix(with a primop that does it? - unclear if that's future proof enough for reproducibility) - add a
baseDirectoryargument tofetchTree
- Resolve git relative path inputs in
Alternative solution
Forbid altogether. This blocks some users:
Additional context
- fetchers/git: make relative path absolute for local repo #12107
- Warn against the use of relative 'git+file:' flake inputs #12277
Add 👍 to issues you find important.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugfeatureFeature request or proposalFeature request or proposalfetchingNetworking with the outside (non-Nix) world, input lockingNetworking with the outside (non-Nix) world, input lockingidea approvedThe given proposal has been discussed and approved by the Nix team. An implementation is welcome.The given proposal has been discussed and approved by the Nix team. An implementation is welcome.