From 6b670253c05fadfee50fefa4e352106a62f5fe7c Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Fri, 15 Sep 2023 10:42:28 +0200 Subject: [PATCH] update README --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 ```