# PRs ready for review \_

**URL:** https://discourse.nixos.org/t/prs-ready-for-review/3032
**Category:** Development
**Created:** [May 25, 2019, 10:38pm UTC](https://discourse.nixos.org/t/prs-ready-for-review/3032 "2019-05-25T22:38:38Z")
**Posts on this page:** 1
**Showing post:** 4813

<div class="post-metadata">

### Author: ![k0kada](https://discourse.nixos.org/user_avatar/discourse.nixos.org/k0kada/32/12502_2.png) [@k0kada](https://discourse.nixos.org/u/k0kada)
#### Post date: [November 9, 2024, 9:53am UTC](https://discourse.nixos.org/t/prs-ready-for-review/3032/4813 "2024-11-09T09:53:09Z")

</div>

The first PR for a new `nixos-rebuild` is ready:

> <https://github.com/NixOS/nixpkgs/pull/354029>
>
> The current state of \`nixos-rebuild\` is dare: it is one of the most critical pie…ce 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
> \- 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 since the code seems to predate \`--print-out-paths\` flag
> 
> Given all of those above, improvements in the \`nixos-rebuild\` are difficult to do. A full rewrite is probably the easier way to improve the situation since this can be done in a separate package that will not broke anyone. So this is an attempt of the rewrite.
> 
> The language of choice here is Python. I am open to other options here, and I mostly choose Python since it is the language I am most comfortable here, but I am open for other options. Still, I think Python is a good choice because:
> 
> \- It is the language of choice for many critical things inside \`nixpkgs\`, like the \`NixOSTestVM\` and \`systemd-boot\` activation scripts
> \- It is a language with great tooling, e.g.: \`mypy\` for type checking, \`ruff\` for linting, \`pytest\` for unit testing
> \- 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 probably need zero external dependencies for this project. For example, \`nixos-rebuild\` currently depends in \`jq\` for JSON parsing, while Python has \`json\` in standard library
> 
> I am aware about the current \[\`switch-to-configuration-ng\`\](https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/sw/switch-to-configuration-ng/README.md) rewrite, however I am not sure what is the scope of that project vs \`nixos-rebuild\`. If the idea is just a drop-in replacement than both of those rewrites are ortogonal, since \`nixos-rebuild\` also includes some extra logic for e.g.: profile management. If the idea is to migrate more and more logic to \`switch-to-configuration-ng\` and eventually drop \`nixos-rebuild\`, I am happy to close this PR.
> 
> \## Things done
> 
> 
> 
> \- Built on platform(s)
> - \[x\] x86\_64-linux
> - \[\] aarch64-linux
> - \[\] x86\_64-darwin
> - \[\] aarch64-darwin
> \- For non-Linux: Is sandboxing enabled in \`nix.conf\`? (See \[Nix manual\](https://nixos.org/manual/nix/stable/command-ref/conf-file.html))
> - \[\] \`sandbox = relaxed\`
> - \[\] \`sandbox = true\`
> \- \[\] Tested, as applicable:
> - \[NixOS test(s)\](https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests) (look inside \[nixos/tests\](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
> - and/or \[package tests\](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests)
> - or, for functions and "core" functionality, tests in \[lib/tests\](https://github.com/NixOS/nixpkgs/blob/master/lib/tests) or \[pkgs/test\](https://github.com/NixOS/nixpkgs/blob/master/pkgs/test)
> - made sure NixOS tests are \[linked\](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#linking-nixos-module-tests-to-a-package) to the relevant packages
> \- \[\] Tested compilation of all packages that depend on this change using \`nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"\`. Note: all changes have to be committed, also see \[nixpkgs-review usage\](https://github.com/Mic92/nixpkgs-review#usage)
> \- \[x\] Tested basic functionality of all binary files (usually in \`./result/bin/\`)
> \- \[24.11 Release Notes\](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2411.section.md) (or backporting \[23.11\](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2311.section.md) and \[24.05\](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2405.section.md) Release notes)
> - \[\] (Package updates) Added a release notes entry if the change is major or breaking
> - \[\] (Module updates) Added a release notes entry if the change is significant
> - \[\] (Module addition) Added a release notes entry if adding a new NixOS module
> \- \[x\] Fits \[CONTRIBUTING.md\](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
> 
> \<!--
> To help with the large amounts of pull requests, we would appreciate your
> reviews of other pull requests, especially simple package updates. Just leave a
> comment describing what you have tested in the relevant package/service.
> Reviewing helps to reduce the average time-to-merge for everyone.
> Thanks a lot if you do!
> 
> List of open PRs: https://github.com/NixOS/nixpkgs/pulls
> Reviewing guidelines: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#reviewing-contributions
> \--\>
> 
> \---
> 
> Add a :+1: \[reaction\] to \[pull requests you find important\].
> 
> \[reaction\]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
> \[pull requests you find important\]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc

See more details and discussion here: [Nixos-rebuild-ng: a nixos-rebuild rewrite](https://discourse.nixos.org/t/nixos-rebuild-ng-a-nixos-rebuild-rewrite/55606).

---

_[View the full topic](https://discourse.nixos.org/t/prs-ready-for-review/3032)._
