-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Flakes: Add "" as the first prefix to try #5657
Conversation
Isn't it better to just try the prefixes returned by |
You're right. I couldn't make much sense of where the prefixes are defined and used, and this seemed like the easiest solution, though it is inadequate. I still think the best solution is to have the |
A complication comes from different commands looking in different places for their preferred attrs. eg: “nix develop” looks in devShell, but should “nix develop .#myshell” first check outputs.devShell.myshell or outputs.myshell? The defaults in getDefaultFlakeAttrPathPrefixes are most applicable to things like “nix build”. |
|
This is going to make More generally, if I feel like perhaps a better approach is to have a separate syntax for "don't apply any prefixes to this fragment". For example, something like |
I don't think "reproducibility" is an issue here, because this is for the CLI. The CLI commands necessary to do something might change over time, and isn't important at all IMO. Reproducibility happens through the flake itself. Adding a whole new syntax for this is quite overkill IMO, and I'm having a hard time imagining any scenario where this behavior would be undesirable. |
It's for the CLI, but the CLI is the interface used by scripting. Besides, predictability is important, not just for making things work, but also for understanding what happened when something went wrong.
It prevents the flake author from adding outputs if they would conflict with fragments that are currently valid. It also prevents flakes from adding packages whose names match those of existing outputs without those packages being hard to reference. For example, if someone adds a package More generally, the I do think there's a need for being able to reliably refer to outputs by name. But saying "prioritize these over the prefixed outputs" is ignoring the fact that most users aren't trying to access outputs by name, and it will just end up being a footgun. So either we should have a separate syntax that means "don't prefix", or we should have some separate means of doing this, such as a |
I think this issue is made worse by the fact that |
I marked this as stale due to inactivity. → More info |
CC @lilyball
When using
It currently does not do this necessarily. It can also resolve to
You already have to, see above.
Why? I think it's really important to have the ability to select any flake output from the flake, which is impossible in general with the way things currently are. If someone, as in your example, adds a The fact that flake authors should mind their outputs is, in my mind, much less important then flake users being completely unable to access certain outputs sometimes. |
(also, I think this behavior should be disabled for more low-level tools such as |
We’ve been playing with this concept as a way to signal to the CLI that there should be no automatic resolution or searching:
it is also helpful for performance and usage in scripts. Sometimes you don’t want to eval legacyPackages searching for an attrPath when you already know the fully resolved path. |
Triaged in the Nix Team meeting this morning (n.b. I could not make it): Alternative: flag or syntax to make the flake paths absolute (both existing as PRs)
For this PR:
Assigned to @roberth |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-08-04-nix-team-meeting-minutes-77/31487/1 |
@L-as iirc when we discussed this, you thought absolute paths are a good alternative. I think the arguments were:
Did I overlook something, or shall we close this? |
Backward-compatibility is important, even for the CLI. |
Fixes #5651