Closed
Description
Is your feature request related to a problem?
Users of flakes in repositories with somewhat-nested tree layouts often get into positions where they have to:
import ../../../../foo.nix
This is error-prone. For example, if foo.nix
gets moved around, it's easy to add a ../
too much, causing errors.
Furthermore, this is very much not nice to look at.
Proposed solution
Resolve a path of form //path
to the flake's root directory. If I have a flake.nix
in /home/me/my-project/flake.nix
, and the project layout is as follows:
/home/me/my-project/foo/bar.nix
:"foo"
/home/me/my-project/some/deeply/nested/tree/package.nix
:import //foo/bar.nix
Evaluating /home/me/my-project/some/deeply/nested/tree/package.nix
should return "foo"
.
Alternative solutions
Passing self
around should work, but having a short-hand path operation for this would be nice.
Additional context
Checklist
- checked latest Nix manual (source)
- checked open feature issues and pull requests for possible duplicates
Add 👍 to issues you find important.