diff --git a/README.md b/README.md index 8f829eb..02c0cfc 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ To apply the updates, continue with "Build and switch". sudo nixos-rebuild -I nixos-config=hosts/$(hostname)/configuration.nix switch ``` +To view changes, see section "Compare two versions of NixOS system profile". + #### Option II: Build new config and activate it during next boot: ```shell @@ -318,6 +320,24 @@ Excerpt of the result: ### Compare two versions of NixOS system profile +Get latest system profile. This is the profile (usually) being active after booting the system: + +```shell +ls -1 /nix/var/nix/profiles/ | sort -t'-' -n -k2 | tail -n 1 +#=> 120 +``` + +Compare current with previous profile: + +```shell +# https://stackoverflow.com/a/36641298 +prev="$(ls -1 /nix/var/nix/profiles/ | sort -t'-' -n -k2 | tail -n 2 | head -n 1)" +curr="$(ls -1 /nix/var/nix/profiles/ | sort -t'-' -n -k2 | tail -n 1)" +nix --extra-experimental-features nix-command store diff-closures /nix/var/nix/profiles/"${prev}" /nix/var/nix/profiles/"${curr}" +``` + +Compare two arbitrary system profiles: + ```shell nix --extra-experimental-features nix-command store diff-closures /nix/var/nix/profiles/system-110-link /nix/var/nix/profiles/system-116-link ```