-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
nix: add nix flake root
#8486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
nix: add nix flake root
#8486
Conversation
src/nix/flake.cc
Outdated
addFlag({ | ||
.longName = "as-ref", | ||
.shortName = 'r', | ||
.description = "Show flake root as a normalized flake ref.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a normalized flake ref?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like git+path:/path/to/flake/folder
instead of /path/to/flake/folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The word "normalized" never shows up in the manual at all, and flakeref is written without a space. Maybe "Show the root as a flakeref in URL-like representation." This way people can check in the manual what that actually means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed the flag description
src/nix/flake.cc
Outdated
|
||
std::string description() override | ||
{ | ||
return "get flake root"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be something like "get the root directory of a flake"? Not entirely clear what "flake root" means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed the description
int slashIndex = rootRef.find('/'); | ||
while (rootRef[slashIndex + 1] == '/') { | ||
slashIndex++; | ||
} | ||
rootRef = rootRef.substr(slashIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not clear to me what this does...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it just eats out that flake specific part
Does it look for the flake directory or for the flake root? (And did we settle on those terms?)
To be clear this command is not a solution for that issue, but I appreciate the link. |
Nix already has a logic to go up levels and find the flake.nix. This subcommand just exposes what it finds. Signed-off-by: lucasew <[email protected]>
Motivation
Nix already has a logic to go up levels and find the flake.nix. This subcommand just exposes what it finds.
Context
Implementation guide for #8034
Consumes logic introduced in #5720
Checklist for maintainers
Maintainers: tick if completed or explain if not relevant
tests/**.sh
src/*/tests
tests/nixos/*
Priorities
Add 👍 to pull requests you find important.