From 7db2ddc8e302db93994261743772f76464f82d05 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 10 Dec 2024 13:24:25 +0000 Subject: [PATCH] nixos-rebuild-ng: update README.md --- pkgs/by-name/ni/nixos-rebuild-ng/README.md | 42 +++++++++++----------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/pkgs/by-name/ni/nixos-rebuild-ng/README.md b/pkgs/by-name/ni/nixos-rebuild-ng/README.md index 800234fe6dc7..0bf680f0cced 100644 --- a/pkgs/by-name/ni/nixos-rebuild-ng/README.md +++ b/pkgs/by-name/ni/nixos-rebuild-ng/README.md @@ -44,6 +44,9 @@ an attempt of the rewrite. ## How to use +If you want to use `nixos-rebuild-ng` without replacing `nixos-rebuild`, add to +your NixOS configuration: + ```nix { pkgs, ... }: { @@ -53,16 +56,29 @@ an attempt of the rewrite. And use `nixos-rebuild-ng` instead of `nixos-rebuild`. +If you want to completely replace `nixos-rebuild` with `nixos-rebuild-ng`, add +to your NixOS configuration: + +```nix +{ ... }: +{ + system.rebuild.enableNg = true; +} +``` + +This will set `config.system.build.nixos-rebuild` to `nixos-rebuild-ng`, so +all tools that expect it in that location should work. + ## Development Run: ```console -nix-build -A nixos-rebuild-ng.tests.ci +nix-build -A nixos-rebuild-ng -A nixos-rebuild-ng.tests.linters ``` -The command above will run the unit tests and linters, and also check if the -code is formatted. However, sometimes is more convenient to run just a few +The command above will build, run the unit tests and linters, and also check if +the code is formatted. However, sometimes is more convenient to run just a few tests to debug, in this case you can run: ```console @@ -85,12 +101,8 @@ ruff check --fix . ruff format . ``` -## Current caveats +## Caveats -- For now we will install it in `nixos-rebuild-ng` path by default, to avoid - conflicting with the current `nixos-rebuild`. This means you can keep both in - your system at the same time, but it also means that a few things like bash - completion are broken right now (since it looks at `nixos-rebuild` binary) - Bugs in the profile manipulation can cause corruption of your profile that may be difficult to fix, so right now I only recommend using `nixos-rebuild-ng` if you are testing in a VM or in a filesystem with @@ -98,20 +110,6 @@ ruff format . errors can be difficult to understand. If you want to go anyway, `nix-collect-garbage -d` and `nix store repair` are your friends -## TODO - -- [x] Remote host/builders (via SSH) -- [x] Improve nix arguments handling (e.g.: `nixFlags` vs `copyFlags` in the - old `nixos-rebuild`) -- [x] `_NIXOS_REBUILD_REEXEC` -- [ ] Port `nixos-rebuild.passthru.tests` -- [x] Change module system to allow easier opt-in, like - `system.switch.enableNg` for `switch-to-configuration-ng` -- [x] Improve documentation -- [x] `nixos-rebuild repl` -- [x] Generate tab completion via [`shtab`](https://docs.iterative.ai/shtab/) -- [x] Reduce build closure - ## TODON'T - Reimplement `systemd-run` logic: will be moved to the new