Is there a way or program to make the output of nixos-rebuild more informative? I know that there are wrappers for apt and was wondering, if there is some equivalent for nixos-rebuild.
For example, i find this output not very informative:
I would rather like to see the individual package size, old version → new version, the packages grouped together according to their dependency on each other, coloring etc. if possible. Is there a way to do that?
For a nix-build in isolation, this does not make a lot of sense: there can be multiple versions of a package in the store, and in your current system. nix-build does not necessarily know whether you’re “upgrading” to a newer version, or adding one besides the existing one.
That said, there are tools like nvd or nix store diff-closures that allow you to compare two derivations.
For your other points, they do seem like reasonable requests. nix-output-monitor for one seems to have a dependency tree view.
~ ❯ nvd diff $(ls -d1v /nix/var/nix/profiles/system-*-link|tail -n 2)
Path does not exist: v0.10.1 [+git]
If i run
~ ❯ sudo unbuffer nixos-rebuild switch --upgrade &| nom && nvd diff /run/current-system result 7s
unpacking channels...
building Nix...
building the system configuration...
activating the configuration...
setting up /etc...
reloading user units for sperber...
setting up tmpfiles
Finished at 17:01:19 after 7s
Path does not exist: result
it also doesn’t work. This doesn’t work either:
~ ❯ nvd diff result-old result-new
Path does not exist: result-old
@R-VdP could you please elaborate on what i have to do to use it in my configuration.nix so that it is run after each nixos-rebuild? I’m still learning Nixos and have never seen this before…
I tried to enable experimental-features like this:
and then you can put the contents of the module that I shared earlier, in configuration.nix:
system.activationScripts.diff = ''
if [[ -e /run/current-system ]]; then
echo "NixOS system closure diff:"
${pkgs.nix}/bin/nix store diff-closures /run/current-system "$systemConfig"
fi
'';
Or you copy the module in a separate file next to configuration.nix, and in configuration.nix you say imports = [ ./update-diff.nix ];