Add support for "path:./relative/path" #18
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/flake-compat#18
Loading…
Reference in a new issue
No description provided.
Delete branch "BBBSnowball/pr-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
My system config flake uses
inputs.private.url = "path:./private";
for information that is ok to be in the store but shouldn't be on Github. This is a git submodule so a relative path feels like the right way to refer to it.Without this patch, flake-compat wants an absolute path:
A more generic solution would allow for any relative path (possibly parents, for instance, which are accepted by flakes too) and not just './':
I like the idea, done in
d1a6788892
However, this would cause inconsistent behavior for
"relative/path"
vs.".hidden/path"
, right? Should we rather test withif builtins.substring 0 1 info.path != "/"
? We don't have anyisAbsolutePath
in builtins, it seems.nixpkgs seems to be doing the same, e.g. here:
78782d368e/lib/sources.nix (L131)
Are there any use cases that may be broken by this?
Ah yes I forgot about hidden paths (isn’t there a story about that being the initial reason why paths starting with "." were hidden ? 😁 ), checking for "/" as first char is fine :)
I didn't know that. Something like "let's hide
.
and..
" and they were hiding.hidden
, as well? If you ever find that story again, please send me a link. :)Done.
This kind of story:
https://linux-audit.com/linux-history-how-dot-files-became-hidden-files/
Note that although it seems quite a plausible story I never went to check that it was actually true (there were probably control version at that time, so it’s probably easy to check if it’s true though :p )
Thanks :)
If I understand correctly, this now allows for completely arbitrary paths, doesn't it? This is the current behavior of real flakes. As flake-compat should mimic real flake behavior, note this comment in the path fetcher:
So, this will probably have to be changed in the future again. Nevertheless, this PR adjusts flake-compat to current flake behavior, so it would be great to merge this, @edolstra.
Yes. The old code allows arbitrary absolute paths. This PR adds support for arbitrary relative paths.
Do you know which paths are not allowed? I thought any path would be ok: Store paths are passed as-is and other paths are copied to the store. If this is not so, I should probably adjust my flakes sooner than later. I'm using lots of relative paths.
We may want to forgo this PR or adjust it if this change is landing soon-ish, e.g. documentation exists and/ or code exists in some branch. If I know what to change, I can adjust the PR.
On a second thought: I think flake-compat is already more lenient than real flakes. For example, I had to change some code that was building temporary paths to /etc, which obviously isn't allowed in a real flake (but flake-compat cannot check for this). We might be ok with flake-compat being simple and a superset of (rather than identical to) real flakes, right?
Well, currently flake-compat is more strict than real flakes by not allowing relative paths. I don't think it is clear wether "path:../" will be allowed in the future, but relative paths in the top-level flake will probably stay possible if you look at the discussions in https://github.com/NixOS/nix/issues/3978 and https://github.com/NixOS/nix/issues/4218. The RFC also lists the
path
input type without mentioning wether it's relative or absolute.added to https://github.com/nix-community/flake-compat
Pull request closed