nixos-rebuild-ng: support using nix-output-monitor#455383
nixos-rebuild-ng: support using nix-output-monitor#455383philiptaron wants to merge 10 commits intoNixOS:staging-nixosfrom
Conversation
I'm interested in using `nom` for `nixos-rebuild`, which wants to do this. In order to avoid the patch breaking on upgrade without someone noticing, it's applied unilaterally, just with do-nothing replacements.
This enables removal of the `with` statements in the derivation.
It's a little strange to patch something that's in Nixpkgs, but it works great.
This provides the place to customize the Nix being executed without needing to use `propagatedBuildInputs`.
`nom` doesn't accept `--extra-experimental-features` before `nom build`; since `nix` accepts it anywhere in the command line, put it after the build. The tests also need to be updated for the `NIX_OR_NOM` constant.
This uses `nix-output-monitor` to produce a much better looking `nixos-rebuild` experience.
thiagokokada
left a comment
There was a problem hiding this comment.
Did just a very high look at this, but there is a bunch of controversial changes:
- It seems that now this always run the reexec code, while the original version this is conditionally enabled on purpose (we disable this if the user runs
nixos-rebuild-ngstandalone, i.e., not as part of NixOS, because reexec can do the wrong thing in those cases) - There is some undocumented changes in behavior, like printing help instead of the manpage
- Hardcoding binary names to be patched later. This seems bad because we will need to update the patch every time we need to add a new executable
- Not sure why we need to split the package in 3 files? I like the split between tests and the main package, but anything else seems unnecessary
In general this PR just seems to be trying to many things at once. To get it to a mergeable state I would recommend trying to focus in either introducing nix-output-monitor or refactoring the code. But even them I would prefer for us to talk before doing bigger refactoring, there is a reason a few things are the way they are.
Yes, let's definitely do that. How about here? I'm also available on Matrix, but for these sorts of discussions I prefer GitHub. I'll respond in separate threads to the other issues, and I'm always glad to split into multiple PRs. |
Since I think this will need some back and forth I think Matrix will work better. But as a general feedback:
I think this should be enough for now, but if you want I can do a proper review tomorrow. |
|
Is there a matrix room for these sorts of discussions? One reason I favor GitHub is due to the ease with which we can scope the discussion but still have it in public. The other is that my favorite matrix client just got ejected from Nixpkgs due to a dependency on libsoup, so I am currently adapting (poorly) to other clients. |
| }; | ||
|
|
||
| options.system.rebuild.enableNom = lib.mkEnableOption "" // { | ||
| default = false; |
There was a problem hiding this comment.
I think this is the default already.
There was a problem hiding this comment.
Sounds good, I'll remove.
There was a problem hiding this comment.
I can't really review the nix-output-monitor changes so you better ping the maintainer for that.
There was a problem hiding this comment.
But do we really need those patches? When we wrap the Python programs we add everything from nativeBuildInputs to the PATH. So I assume just adding nix-output-monitor to nixos-rebuild-ng derivation should be sufficient here.
There was a problem hiding this comment.
That's true. I preferred to avoid the wrapper in favor of embedding the Nix store path in the file, but I'll respect your choice in the matter.
| pytestFlags = [ "-vv" ]; | ||
|
|
||
| makeWrapperArgs = | ||
| lib.optional (!withReexec) "--set NIXOS_REBUILD_REEXEC_ENV 1" |
There was a problem hiding this comment.
I know this looks a clever way to avoid having this as a build constant, but the reason we had this is because we can run nixos-rebuild-ng without building it (by running nix-shell -A nixos-rebuild-ng.devShell && python -m nixos_rebuild) and this is nice for hacking new features.
Now if you do the same this will try to re-exec instead so you can really hack new things, unless you remember to pass --no-reexec flag.
There was a problem hiding this comment.
I am against us patching files for code that is inside the nixpkgs street since this makes adding new features unnecessary complicated: we need to add the code first, commit, modify the code, create a patch and commit the path. This is why the constants.py file was the way it was.
There was a problem hiding this comment.
I'll return to the constants/--replace-fail route.
There was a problem hiding this comment.
Same here, let's avoid needing to patch code that is inside nixpkgs.
There was a problem hiding this comment.
Sounds good. I'll return to the constants route.
thiagokokada
left a comment
There was a problem hiding this comment.
BTW, does this support --target-host and --build-host ? I don't think it is necessarily a blocker to not support them, but if we don't support we need to at least document this somewhere.
This PR introduces the NixOS option
system.rebuild.enableNom, which causesnixos-rebuild-ngto usenix-output-managerto display a beautiful tree of dependencies being built.Its first commit is from #454982 which should be merged first.
Recommend reviewing commit-by-commit. Most of the commits prior to the last one are just refactoring and could be jettisoned if objected to, but ... I like them. 🙂
I tested this out on my system and it works great.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.