Chances of landing changes to nixos-rebuild in nixpkgs

For about some time I’ve been willing to add a new option to nixos-rebuild and, possibly, home-manager. It’s been a couple of months since I discovered the edit option in both of those command which is very convenient: I don’t need to write vim /etc/nixos/configuration.nix every time I want to change something, I just do nixos-rebuild edit and it’s open, such a nice and simple touch… Considering that every time you want to make changes to your NixOS instance you work with this command, such “convenience” options are a blessing.

Given that there exists at least one “convenience” feature I’m wondering would there be any barriers in adding another one? I mean pushing upstream, I obviously can create overlays for myself and whatnot. I’ve got this question because when I looked at the nix-bash-completions repo I noticed that it was last updated 4 years ago. I checked and it is actually used on NixOS by default for all of the nix tools (except for nix itself), so, I guess, there weren’t any significant “api” changes for quite a long time. I could be wrong, maybe this repo is just not being updated, who knows, the question stands nonetheless.

I know I should have started with this, but I didn’t. I would like to have a new “convenience” feature in nixos-rebuild: something like nixos-rebuild reference or a shorter nixos-rebuild ref that simply does exec man configuration.nix. I find it somewhat uneasy having to write a completely different, long and unrelated command when I want to look into the option reference. A simple ^P^W ref ^J could be much quicker than typing man configuration.nix anew or searching through history. I would also argue this is a good thing for newcomers as it would probably take them much shorter to realize that all of the vital documentation is already there installed locally instead of looking into the web-based docs. They may find it through either tapping tab and seeing an eye-catching “reference” option or looking through the man page (I would, of course, add some information about it there).
The case exacerbates with home-manager even more as it is absolutely not obvious that home-manager has local option reference in man home-configuration.nix which is, you guessed it, also both unrelated to the original command and is a lengthy name too.

My question is mostly addressed to active maintainers. I would like to have this feature, so I’ve made my investigation into what has to be done in order to make such changes (and make them properly), looks like ain’t too much of a hassle even with completions, docs and all that stuff, I can surely do that. So, should I even try?

1 Like

Honestly, I don’t see much value in this: nixos-rebuild edit is more interesting because il looks up the <nixos-config> variable from $NIX_PATH, while nixos-rebuild ref can be trivially done with a shell alias/function.

There are much bigger problems with nixos-rebuild I would suggest working on, like:

  1. you can’t easiliy get a list of generations: this requires running nix-env --list-generations --profile /nix/var/nix/profiles/system as root.

  2. you can’t switch or boot to an arbitrary generation

  3. you can’t rollback after a test

  4. you can’t switch back to the base system after having activated a --specialisation