Skip to content
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

tree-wide: rename nixos-rebuild to nixos-config #100578

Closed
wants to merge 1 commit into from

Conversation

zimbatm
Copy link
Member

@zimbatm zimbatm commented Oct 15, 2020

Motivation for this change

After all these years, nixos-rebuild is still weird to type.
nixos-config is much more intuitive.

Compare nixos-rebuild build vs nixos-config build. Or nixos-rebuild switch with nixos-config switch. A fresh mind is able to make out
what the latter will do.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

After all these years, `nixos-rebuild` is still weird to type.
`nixos-config` is much more intuitive.

Compare `nixos-rebuild build` vs `nixos-config build`. Or `nixos-rebuild
switch` with `nixos-config switch`. A fresh mind is able to make out
what the latter will do.
@jtojnar
Copy link
Contributor

jtojnar commented Oct 15, 2020

This does not feel any less weird to me, we are not building or switching a configuration, we are rebuilding a system using a configuration. If anything it would make sense to just name the command nixos as was proposed before.

But if we rename it we should also apply all the other proposed breaking changes, to avoid people having to migrate twice.

Not sure who proposed it and where, though. Edit: Looks like I was thinking of this: #54188

@zimbatm
Copy link
Member Author

zimbatm commented Oct 15, 2020

I don't see #54188 realistically being adopted. It's trying to reach for perfection and opens a lot of rabbit holes. There is a reason why it's been open for 1.5 years.

nixos-config is essentially operating on the nixos configuration so semantically has a meaning. The system is being built from that configuration. What does nixos-rebuild mean?

Another example is nixos-config edit which also makes more sense.

What we could do in a future PR is introduce a nixos command dispatcher. This would allow to make all the commands more discoverable and introduce aliases. nixos option, nixos version, ... While still keeping backward-compatibility.

@zimbatm
Copy link
Member Author

zimbatm commented Oct 15, 2020

Another argument is that it's important to keep backward-compatibility. What slnos did is great but they has less users so they don't have to worry about keeping back-compat as much as we do.

@edolstra
Copy link
Member

nixos-config is an improvement over nixos-rebuild, but having a single nixos command would be even better.

It's trying to reach for perfection and opens a lot of rabbit holes.

I don't think it needs to be perfect immediately. E.g. we could just start by renaming nixos-rebuild to nixos and then later merging other commands into it.

Another argument is that it's important to keep backward-compatibility.

Well, that applies to renaming nixos-rebuild to nixos-config as well. We just need to provide a compatibility symlink for some commands. (I don't think we need compatibility for nixos-option, nixos-infect, nixos-lustrate etc. since they're probably not referenced in a lot of scripts.)

@zimbatm
Copy link
Member Author

zimbatm commented Oct 19, 2020

Should I just rename it to plain nixos then?

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/what-to-show-in-list-of-nixos-generations/11216/6

@domenkozar
Copy link
Member

Just after 21.05 is released would be a really good time to make the flip. Rename and leave nixos-rebuild for backwards compatibility (and maybe a warning that it's renamed).

@FlorianFranzen
Copy link
Contributor

FlorianFranzen commented Jun 28, 2021

I think listing and deleting previous generations should be part of the new nixos command line utility as well.

E.g. I currently use alias nixos-env='sudo nix-env -p /nix/var/nix/profiles/system, but I am sure this could be made much more convenient and informative to the average user.

@asymmetric
Copy link
Contributor

@zimbatm do you have capacity to tackle this anytime soon? Otherwise I'm happy to follow up with an up to date PR.

I think both nixos-config and nixos would be improvements. In the interest of keeping this separate from the Platonic ideal of a nixos top-level command though, I think I'd rather stay conservative/incremental and go with nixos-config. We can aim higher next time.

@infinisil
Copy link
Member

I really don't think we should do this purely for the sake of renaming it. This renaming provides almost zero benefit at a huge cost.

Instead we should keep this possibility in mind for when we might do a bigger redesign of the NixOS CLI, such as perhaps with Flakes, or with a general modernization or UX improvement, similar to the Nix CLI. When that happens, a name change comes at no cost, as people will be relearning a new interface anyways.

@zimbatm
Copy link
Member Author

zimbatm commented Jun 29, 2021

agreed, there is a cost to rename things

@zimbatm zimbatm closed this Jun 29, 2021
@zimbatm zimbatm deleted the nixos-config branch June 29, 2021 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants