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

New nixos executable #54188

Open
danbst opened this issue Jan 17, 2019 · 19 comments
Open

New nixos executable #54188

danbst opened this issue Jan 17, 2019 · 19 comments

Comments

@danbst
Copy link
Contributor

danbst commented Jan 17, 2019

Issue description

nixos-rebuild interface looks a bit archaic. Maybe we can have a better Nixos frontend CLI?

Just brain dump, but...

Technical details

Basic features:

  • installable as package, even on non-nixos
  • is named nixos
  • is written in C++ and binds to Nix C++ library (or maybe Haskell? Nodejs? What you think?)
  • autocomplete, ncurses, Nix 2.0
  • commit to Git by default on each rebuild, warns on used .nix files outside of git repo

Subcommands

First I'll describe existing nixos-rebuild switches, that should go into new command:

  • nixos-rebuild switch -> nixos rebuild, nixos rebuild --boot --activate
  • nixos-rebuild boot -> nixos rebuild --no-activate
  • nixos-rebuild test -> nixos rebuild --no-boot
  • nixos-rebuild build -> nixos build
  • nixos-rebuild dry-x -> nixos x --dry, nixos x --test
  • nixos-rebuild --build-host -> nixos --build-on
  • nixos-rebuild --target-host -> nixos --deploy-to
  • nixos-rebuild switch --rollback -> nixos rollback opens a curses screen so you can select what to rollback to

Then, existing commands should be intergrated. All of those should work on non-NixOS:

  • nixos-option X -> nixos option X
  • nixos-generate-config -> nixos config --default, outputs to stdout
  • nixos-install -> nixos install
  • nixos-container XXX -> nixos container XXX
  • nixos-version -> nixos -v, nixos --version. nixos -vv should be same as nix-info

Some external projects should be merged in:

  • nixos-infect -> nixos infect --confirm-infect, also nixos infect --confirm-infect --deploy-to

And probably some new stuff added:

  • show all options -> nixos options, the output should be fast and compatible with FZF
  • lustrate thing -> nixos lustrate --confirm-lustrate
  • nixos options --edit should start a webserver, browser and provide interactive point-and-click editing experience

Anything missed?

@leo60228
Copy link
Member

nixos options --edit might be too complicated. However, we could possibly attempt to port the options table from https://nixos.org to have a value column.

@davidak
Copy link
Member

davidak commented Jan 17, 2019

Sounds good!

nixos config --edit could open config in default $EDITOR and later open browser with interactive editor.

commit to Git by default on each rebuild, warns on used .nix files outside of git repo

So should /etc/nixos/ be a git repo? Could be an option for users that don't care.

I have my config in /root/nixos-config and symlink config to /etc/nixos/configuration.nix.

I want to commit after a rebuild was sucessfull. Often i need multiple tries.

An option to not commit would be enough for me.

@hedning
Copy link
Contributor

hedning commented Jan 17, 2019

autocomplete

Use the same self documenting help format as nix and it would be pretty trivial to add support in nix-{zsh,bash}-completions. Completions fornix are already automatically generated from the help (was really nice not having to do anything about the nix-2.2 release :).

@avnik
Copy link
Contributor

avnik commented Jan 19, 2019

Looks good idea for me.

Probably it should be implemented in rust or c++ (I presonally prefer rust here over c++), I asked in IRC about other stuff, and rust was a common language suggestion.

@danbst
Copy link
Contributor Author

danbst commented Mar 7, 2019

Related issue: #51198

I think nixos-lib (or equivalently nixos lib) should contain all NixOS activation scripts, rewritten in C++/Rust/Go/whatever.

@infinisil
Copy link
Member

nixos-rebuild just got an edit command :) #56241

@oxij
Copy link
Member

oxij commented Mar 10, 2019 via email

@matthew-piziak
Copy link
Contributor

Another thing I'd like to see supported is -L/--print-build-logs for nixos-rebuild, which already exists for nix build.

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@davidak
Copy link
Member

davidak commented Jun 1, 2020

this is still needed to make NixOS more userfriendly

a next step could be a usable prototype as wrapper in python or whatever you like

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@matthew-piziak
Copy link
Contributor

Since my last comment I have discovered nix-top, which I use to see what a build is currently struggling with.

@xaverdh
Copy link
Contributor

xaverdh commented Oct 15, 2020

This is not just about usability by the way, there is a lot of duplication in the nixos-* tooling. They all accept roughly the same nix options, which get passed through to nix calls. And actually they do get out of sync with both nix itself and each other from time to time..

@liff
Copy link
Contributor

liff commented Dec 7, 2020

Looks like nixos-rebuild build-vm[-with-bootloader] is missing a subcommand.

@matthiasbeyer
Copy link
Contributor

commit to Git by default on each rebuild

This is an antipattern and I really hope there will be an option to disable this!

@stale
Copy link

stale bot commented Nov 9, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 9, 2021
@liff
Copy link
Contributor

liff commented Nov 10, 2021

Not stale, I hope?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 10, 2021
@misuzu
Copy link
Contributor

misuzu commented Aug 23, 2022

How about nixos gc -d for nix-collect-garbage -d && /nix/var/nix/profiles/system/bin/switch-to-configuration boot?

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/nixpkgs-cli-working-group/30517/5

@water-sucks
Copy link
Member

I've made a precursor to this that's still in very early stages, just to see where it can go. The repo is here, I'd like to see how far this can be taken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests