Auto-upgrade: List package differences
This commit is contained in:
parent
62188455a9
commit
050a28f91f
|
@ -43,9 +43,11 @@ in
|
|||
systemd.services.nixos-upgrade.script = mkOverride 50 (
|
||||
let
|
||||
nixos-rebuild = "${config.system.build.nixos-rebuild}/bin/nixos-rebuild";
|
||||
nix-store = "${pkgs.nix}/bin/nix-store";
|
||||
date = "${pkgs.coreutils}/bin/date";
|
||||
readlink = "${pkgs.coreutils}/bin/readlink";
|
||||
grep = "${pkgs.gnugrep}/bin/grep";
|
||||
diff = "${pkgs.diffutils}/bin/diff";
|
||||
git = "${pkgs.git}/bin/git";
|
||||
ssh = "${pkgs.openssh}/bin/ssh";
|
||||
sudo = "${pkgs.sudo}/bin/sudo";
|
||||
|
@ -121,6 +123,18 @@ in
|
|||
email_body="The system upgrade started at $start_time has failed with exit code $exit_code."
|
||||
fi
|
||||
|
||||
echo "→ Determining package differences." | tee -a "$output_file"
|
||||
installed_packages()
|
||||
{
|
||||
${nix-store} --query --requisites "$1" | cut -d- -f2- | sort | uniq
|
||||
}
|
||||
current_packages="$(installed_packages /run/current-system)"
|
||||
built_packages="$(installed_packages /nix/var/nix/profiles/system)"
|
||||
${diff} -y --suppress-common-lines --width=71 \
|
||||
<(printf "Current generation\n------------------\n%s" "$current_packages") \
|
||||
<(printf "New generation\n--------------\n%s" "$built_packages") \
|
||||
| tee -a "$output_file" || true
|
||||
|
||||
booted_version="$(${readlink} /run/booted-system/{initrd,kernel,kernel-modules})"
|
||||
built_version="$(${readlink} /nix/var/nix/profiles/system/{initrd,kernel,kernel-modules})"
|
||||
|
||||
|
|
Loading…
Reference in a new issue