modules/nixos/common: use preSwitchChecks for update diff
This commit is contained in:
parent
8528527e06
commit
16c333cfde
3 changed files with 9 additions and 6 deletions
modules/nixos/common
|
@ -18,6 +18,15 @@
|
||||||
inputs.srvos.nixosModules.server
|
inputs.srvos.nixosModules.server
|
||||||
];
|
];
|
||||||
|
|
||||||
|
srvos.update-diff.enable = false;
|
||||||
|
system.preSwitchChecks.update-diff = ''
|
||||||
|
if [[ -e /run/current-system && -e "''${1-}" ]]; then
|
||||||
|
echo "--- diff to current-system"
|
||||||
|
${pkgs.nvd}/bin/nvd --nix-bin-dir=${config.nix.package}/bin diff /run/current-system "''${1-}"
|
||||||
|
echo "---"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
# Hard-link duplicated files
|
# Hard-link duplicated files
|
||||||
nix.settings.auto-optimise-store = true;
|
nix.settings.auto-optimise-store = true;
|
||||||
nix.optimise.automatic = false;
|
nix.optimise.automatic = false;
|
||||||
|
|
|
@ -20,11 +20,6 @@ nix-env --profile /nix/var/nix/profiles/system --set "$p"
|
||||||
booted="$(readlink /run/booted-system/{initrd,kernel,kernel-modules} && cat /run/booted-system/kernel-params)"
|
booted="$(readlink /run/booted-system/{initrd,kernel,kernel-modules} && cat /run/booted-system/kernel-params)"
|
||||||
built="$(readlink "$p"/{initrd,kernel,kernel-modules} && cat "$p"/kernel-params)"
|
built="$(readlink "$p"/{initrd,kernel,kernel-modules} && cat "$p"/kernel-params)"
|
||||||
if [[ $booted != "$built" ]]; then
|
if [[ $booted != "$built" ]]; then
|
||||||
if [[ -e /run/current-system ]]; then
|
|
||||||
echo "--- diff to current-system"
|
|
||||||
nvd diff /run/current-system "$p"
|
|
||||||
echo "---"
|
|
||||||
fi
|
|
||||||
/nix/var/nix/profiles/system/bin/switch-to-configuration boot
|
/nix/var/nix/profiles/system/bin/switch-to-configuration boot
|
||||||
# don't use kexec if system is virtualized, reboots are fast enough
|
# don't use kexec if system is virtualized, reboots are fast enough
|
||||||
if ! systemd-detect-virt -q; then
|
if ! systemd-detect-virt -q; then
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
pkgs.coreutils
|
pkgs.coreutils
|
||||||
pkgs.curl
|
pkgs.curl
|
||||||
pkgs.kexec-tools
|
pkgs.kexec-tools
|
||||||
pkgs.nvd
|
|
||||||
];
|
];
|
||||||
script = builtins.readFile ./update.bash;
|
script = builtins.readFile ./update.bash;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue