What is being updated?

I use

sudo nixos-rebuild switch --flake .#

and

nix build .#homeConfigurations.user.activationPackage
./result/activate

to update my system. Is there a way to see which packages are going to be updated before I run these commands, or a way to see which packages were updated after the fact?

to see it after the fact (but you can then rollback), I recently found on this very discourse the following snippet:

  system.activationScripts.report-nixos-changes = ''
    PATH=$PATH:${lib.makeBinPath [ pkgs.nvd pkgs.nix ]}
    nvd diff $(ls -dv /nix/var/nix/profiles/system-*-link | tail -2)
  '';

  system.activationScripts.report-home-manager-changes = ''
    PATH=$PATH:${lib.makeBinPath [ pkgs.nvd pkgs.nix ]}
    nvd diff $(ls -dv /nix/var/nix/profiles/per-user/teto/home-manager-*-link | tail -2)
  '';
2 Likes
  1. instead of switching directly, you can build first
  2. then you can use nix-diff or nvd on the build result and the active profile
  3. instead of running the HM activation manually, you really should use the home-manager CLI

What would that look like? I am using what Wil T suggested in his video on using flakes.

https://nix-community.github.io/home-manager/index.html#sec-flakes-standalone

home-manager switch --flake your-flake

1 Like