-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
nix flake update --single <name>
is more intuitive than nix flake lock --update
#5110
Comments
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-update-a-single-flake-input/13584/6 |
I strongly agree with OP, if Flakes are supposed to make Nix more approachable we should aim to minimize confusion and optimize the UX for discoverability. |
Or even
|
might also be nice to have a |
As a Nix beginner who was just wondering why |
I have to google this command every time I want to update a single input. |
This really needs an UX improvment.
I'd recommend the following:
|
I think there's plenty of agreement here, it'll take a PR to get things moving :) |
It isn't.
See also the discussion in #3781. |
At the very least it's difficult to find 😅 |
I just ran into this myself. I saw that
until going off on another lengthy search today and ending up at this issue. I'd suggest it might useful to override any technical consistency of the current approach in favour of a more intuitive UX? |
I think the following would be more intuitive:
The main rationale for keeping single- and multi-input updates under the same command: it's just confusing to everyone that you currently need two. |
I understand both sides but think the status quo is bad. I think there are two solutions:
|
We discussed that a bit during the last UX meeting. The broad outcome was that:
One suggestion to reduce the confusion was to simply make the fact that |
This doesn't seem inconsistent with making |
It's not indeed. However doing so would be inconsistent with the fact that |
Honestly, I doubt beginner users will ever want to update any other flake than What's the usecase for Beginners want the ability to easily update these on their own flake (
I don't think they're gonna want to dig into lockfile-related
Documentation is good, but if the UX of the tool is confusing, it should be improved at the source, and not just documented. Especially now, while flakes are experimental. |
Backwards consistency isn't really the matter here (as you say, it's experimental, we could break things). I agree that taken individually, this command could make more sense in the form If anything I'd rather remove |
That one obviously doesn't make any sense, but |
I don't think
|
Do you mean that you'd call it as |
@thufschmitt that's right. I see how It's not going to be consistent with the way of passing the flake reference as a positional argument, but sticking to that for the sake of consistency would make for a less intuitive UX for users. In my view Another idea - provide syntax to refer to a flake input. Then it'd be like |
Lockfile operations
Why the current UX is badThe split into two commands is confusing. Bundling all lockfile operations into one command would lead to a more intuitive and discoverable interface. Example user story: A user wants to update a specific input of a flake.
Solution: Single command
Suggested output of
Suggested design of nix flake update
nix flake update --update-input <input>
nix flake update --add-missing # replaces `nix flake lock`, which is seldomly called on its own |
I don't think this is true. It's pretty common to add a new input, where you want to update the lockfile to reflect the new input without upgrading every other input. In the new UI we try to avoid flags that negate what a command does, e.g. a I do think |
Nix really should fix the
|
A If I do not want this behaviour I have to explicitely opt out using |
@iFreilicht your suggestion is an improvement on the status quo, so in that regard I think it's fine. That said, I think "it's inconsistent with any other command" is kind of an anti-argument, given our regard for the status quo. 😅 Taken on its own merits, specifying which flake to update seems like a niche use case (I've never used it), so specifying it as a required argument seems un-ergonomic. Talk is cheap, though, so please do proceed as you see fit, regardless of my opinions. |
I agree with @chreekat on the positional argument. I think a This is plain unreadable: nix flake update /path/to/that/flake nixpkgs home-manager flake-utils I have no idea what this command is doing here. Ok, so I'm updating a flake, and that first thing is a path, seems to be a flake, so given the subcommand it probably updates that. But what the hell are these other args about (especially if they're less common flake inputs than what I assume are the most common three...)? This either needs an And yes, talk is cheap ;p |
re: @iFreilicht sorry if I've missed something catching up, but did you mean |
Yeah after starting to look at the codebase and experimenting a little bit, So the only scenario is for a different path, not flake-refs outright, and I'd be very surprised if there were so many people doing that, that |
Sorry to wade back in after being absent from this thread, but I have some strong feelings.
cd /this/is/not/a/git/worktree
git clone https://some/flake ~/myflake
git -C ~/myflake rebase -i
nix flake -C ~/myflake lock --recreate-lock-file
nix flake -C ~/myflake lock --override-input nixpkgs ~/nixpkgs_fork
nix flake -C ~/myflake update # doesn't do anything, spits out a warning and usage info
nix flake -C ~/myflake update --all # cmd2
nix flake -C ~/myflake update --input nixpkgs-wayland
nix flake -C ~/myflake update --input nixpkgs --input nixpkgs-wayland edit: maybe for fun |
@colemickens Please show me an example from the dozens of existing dependency management tools where Edit: Here's some concrete examples with the Rust and Python dependency managers.
|
Just to be clear, are you talking about mixing the types of positional arguments like I proposed?
Or are you talking about using positional arguments in general, like @TLATER and @chreekat proposed?
The former I agree with, it's not a great idea, it's confusing an error-prone. But I'm really having a hard time seeing the issue with the latter one.
What would those be, roughly?
Sure, but we seem to disagree what intuitive means. Intuition is built from our individual experiences, and so what we deem intuitive differs. I of course appreciate you voicing your opinion, but the general sentiment of this thread seems to be that the most common usecase should be the simplest and most obvious one, and so what's intuitive in this context is a democratic decision.
I do like the idea, kind-of, but operating on any flakeref is very useful and common for almost all
I do like that idea, and I will try to implement it for flakes where this action isn't known to be reversible. I'd still argue that offering a simple yes/no dialog is the user friendly and low-friction solution, as opposed to erroring out, but a little encouragement isn't misplaced here. |
@colemickens Ahh I just saw that you're actually the person who opened this ticket in the first place! After reading through the code for the last hours, let me give you an answer to your initial questions:
The reason is that Nix actually tries very hard to be 100% consistent to the point of being confusing. Under many commands in the nix manual, you'll see a section "Common flake-related options:". Any command that can take a flake as an input can take these. I think for something like This does enable you to call And these flags can of course also be parsed to I'm not entirely sure what the motivation was for this design, I guess to have primitives you could build command invocations from? No matter what, this generalization clearly gets in the way when the only thing you want to do is update inputs. |
nix flake update --single <name>
is more intuitive than `nix flake lock --updatenix flake update --single <name>
is more intuitive than nix flake lock --update
Discussed in meeting: We've had a discussion about the design. We would love for this UX issue to be made some progress on, and here's our thoughts on it: Low hanging fruit is adding Detailed notes:
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-08-11-nix-team-meeting-79/31627/1 |
Good, it seems that's in line with the expectations of those who raised their voice so far.
Agreed.
We have an excuse to diverge from the convention, which is; the UX is bad and there's no good reason to apply the convention in this particular case. Having
I'm taking the freedom of seeing this as confirmation to my statement above and will remove |
IME this is a big source of confusion for new users who don't understand that everything under |
@9999years Just so we are claer, it is an explicit goal of NixOS/rfcs#136 that the new CLI not be exclusively for Flakes, however. (That one is in FCP and close to being merged unless something new comes up.) |
Though not everything there is only for flakes, but installables, which indeed includes flakes, but also files with But the |
The PR is ready: #8817 For any curious users that want to test it, I added a |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/decision-making-2-0-1-0-1/12851/24 |
Why is
nix flake update
a think instead of justnix flake lock --update-all
?Or why is
nix flake lock --update-input
notnix flake update --single <name>
.Or is there some other reasoning for the current grouping? I don't get it, I have to look it up every time. It just feels inconistent
The text was updated successfully, but these errors were encountered: