feat(update): sys-update/sys-rebuild end with an nvd what-changed diff (item 9a)
All checks were successful
Check / eval (push) Successful in 3m0s

The informative half of 'informative + rock-stable': both rebuild
wrappers capture /run/current-system before the switch and print a
package-level nvd diff after it — store-path-pinned so no PATH
dependence, || true so an ornamental diff can never fail a succeeded
rebuild, and an identical-path fast-path says 'no changes'. README §3
notes it. V1: template-system toplevel rebuilt, generated scripts
bash -n clean, nvd smoke-run against the real closure.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-07-04 20:14:23 +01:00
parent 774bdad6e4
commit 3f5e414341
4 changed files with 46 additions and 9 deletions

View File

@@ -307,11 +307,22 @@ in
flake="''${NOMARCHY_PATH:-$HOME/.nomarchy}"
echo "sys-update: updating flake inputs in $flake"
nix flake update --flake "$flake"
before=$(readlink -f /run/current-system)
if command -v nixos-rebuild-snap >/dev/null 2>&1; then
sudo nixos-rebuild-snap "$@" # BTRFS snapshot first
else
sudo nixos-rebuild switch --flake "$flake#default" "$@"
fi
# What did that update actually change? Package-level diff of the
# old vs new generation (the informative half of "informative +
# rock-stable"); never fails the run.
after=$(readlink -f /run/current-system)
if [ "$before" = "$after" ]; then
echo "sys-update: no changes the system is identical."
else
echo "sys-update: what changed:"
${pkgs.nvd}/bin/nvd diff "$before" "$after" || true
fi
'')
# The no-update twin (hardware-QA request): rebuild the system
# against the CURRENT lock — config changes only, no `nix flake
@@ -324,11 +335,20 @@ in
exit 1
fi
flake="''${NOMARCHY_PATH:-$HOME/.nomarchy}"
before=$(readlink -f /run/current-system)
if command -v nixos-rebuild-snap >/dev/null 2>&1; then
sudo nixos-rebuild-snap "$@" # BTRFS snapshot first
else
sudo nixos-rebuild switch --flake "$flake#default" "$@"
fi
# Same what-changed diff as sys-update (the twins stay twins).
after=$(readlink -f /run/current-system)
if [ "$before" = "$after" ]; then
echo "sys-rebuild: no changes the system is identical."
else
echo "sys-rebuild: what changed:"
${pkgs.nvd}/bin/nvd diff "$before" "$after" || true
fi
'')
(pkgs.writeShellScriptBin "home-update" ''
set -e