nixos-rebuild-ng: improve README.md
This commit is contained in:
@@ -6,16 +6,16 @@ Work-in-Progress rewrite of
|
||||
## Why the rewrite?
|
||||
|
||||
The current state of `nixos-rebuild` is dire: it is one of the most critical
|
||||
piece of code we have in NixOS, but it has tons of issues:
|
||||
pieces of code we have in NixOS, but it has tons of issues:
|
||||
- The code is written in Bash, and while this by itself is not necessary bad,
|
||||
it means that it is difficult to do refactorings due to the lack of tooling
|
||||
for the language
|
||||
- The code itself is a hacky mess. Changing even one line of code can cause
|
||||
issues that affects dozens of people
|
||||
issues that affect dozens of people
|
||||
- Lack of proper testing (we do have some integration tests, but no unit tests
|
||||
and coverage is probably pitiful)
|
||||
- The code predates some of the improvements `nix` had over the years, e.g.: it
|
||||
builds Flakes inside a temporary directory and read the resulting symlink
|
||||
- The code predates some of the improvements `nix` had over the years, e.g., it
|
||||
builds Flakes inside a temporary directory and reads the resulting symlink
|
||||
since the code seems to predate `--print-out-paths` flag
|
||||
|
||||
Given all of those above, improvements in the `nixos-rebuild` are difficult to
|
||||
@@ -32,7 +32,7 @@ an attempt of the rewrite.
|
||||
- It is a scripting language that fits well with the scope of this project
|
||||
- Python's standard library is great and it means we will need a low number of
|
||||
external dependencies for this project. For example, `nixos-rebuild`
|
||||
currently depends in `jq` for JSON parsing, while Python has `json` in
|
||||
currently depends on `jq` for JSON parsing, while Python has `json` in
|
||||
standard library
|
||||
|
||||
## Do's and Don'ts
|
||||
@@ -44,8 +44,8 @@ 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:
|
||||
If you want to use `nixos-rebuild-ng` without replacing `nixos-rebuild`, add the
|
||||
following to your NixOS configuration:
|
||||
|
||||
```nix
|
||||
{ pkgs, ... }:
|
||||
@@ -57,7 +57,7 @@ your NixOS configuration:
|
||||
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:
|
||||
the following to your NixOS configuration:
|
||||
|
||||
```nix
|
||||
{ ... }:
|
||||
@@ -104,12 +104,12 @@ ruff format .
|
||||
## Breaking changes
|
||||
|
||||
While `nixos-rebuild-ng` tries to be as much of a clone of the original as
|
||||
possible, there are still some breaking changes that were done in other to
|
||||
possible, there are still some breaking changes that were done in order to
|
||||
improve the user experience. If they break your workflow in some way that is
|
||||
not possible to fix, please open an issue and we can discuss a solution.
|
||||
|
||||
- For `--build-host` and `--target-host`, `nixos-rebuild-ng` does not allocate
|
||||
a pseudo-TTY via SSH (e.g.: `ssh -t`) anymore. The reason for this is because
|
||||
a pseudo-TTY via SSH (e.g., `ssh -t`) anymore. The reason for this is that
|
||||
pseudo-TTY breaks some expectations from SSH, like it mangles stdout and
|
||||
stderr, and can
|
||||
[break terminal output](https://github.com/NixOS/nixpkgs/issues/336967) in
|
||||
@@ -122,7 +122,7 @@ not possible to fix, please open an issue and we can discuss a solution.
|
||||
every `sudo` request. Keep in mind that there is no check, so if you type
|
||||
your password wrong, it will fail during activation (this can be improved
|
||||
though)
|
||||
- When `--build-host` and `--target-host` is used together, we will use `nix
|
||||
- When `--build-host` and `--target-host` are used together, we will use `nix
|
||||
copy` (or 2 `nix-copy-closure` if you're using Nix <2.18) instead of SSH'ing
|
||||
to build host and using `nix-copy-closure --to target-host`. The reason for
|
||||
this is documented in PR
|
||||
@@ -142,7 +142,7 @@ not possible to fix, please open an issue and we can discuss a solution.
|
||||
- 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
|
||||
snapshots like btrfs or ZFS. Those bugs are unlikely to be unfixable but the
|
||||
snapshots like BTRFS or ZFS. Those bugs are unlikely to be unfixable but the
|
||||
errors can be difficult to understand. If you want to go anyway,
|
||||
`nix-collect-garbage -d` and `nix store repair` are your friends
|
||||
|
||||
|
||||
Reference in New Issue
Block a user