Skip to content

Instantly share code, notes, and snippets.

@danbst
Last active May 27, 2020 07:35
Show Gist options
  • Save danbst/4ea9afd53d580b4b19b4348c9575d627 to your computer and use it in GitHub Desktop.
Save danbst/4ea9afd53d580b4b19b4348c9575d627 to your computer and use it in GitHub Desktop.
Nixos need a replacement for nixos-rebuild!

nixos executable

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

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
  • show all options -> nixos options, the output should be compatible with FZF and fast
  • 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
  • lustrate thing -> nixos lustrate --confirm-lustrate

And finally, some external projects should be merged in:

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

Anything missed?

@AleXoundOS
Copy link

Original nixos-rebuild commands are easier to type, though :)

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