diff options
| author | tv <tv@krebsco.de> | 2026-11-30 18:23:58 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-30 23:04:56 +0000 |
| commit | 10f90010255643c2f48d73bc45ec6467f6afc45d (patch) | |
| tree | 717f3c161f5f4ef61084bd8d53a030f6b8681437 /krops.nix | |
| parent | c4df8322bf2e55f585276c1775c0f85b274b4df3 (diff) | |
krops.nix: check before setting the system profile
switch-to-configuration runs the pre-switch checks only after nix-env has
made the new system the profile, so a refused switch left it to be booted
next time. Only before a switch: check runs the checks as for a switch,
and with boot, those that skip boot would run. The switch itself then
skips them (NIXOS_NO_CHECK), so they don't run twice.
Diffstat (limited to 'krops.nix')
| -rw-r--r-- | krops.nix | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -196,6 +196,10 @@ rec { old_gen=$(readlink -f /nix/var/nix/profiles/system) new_gen=$(readlink -f "$system") if [ "x$old_gen" != "x$new_gen" ]; then + ${lib.optionalString (switch == "switch") /* sh */ '' + "$system"/bin/switch-to-configuration check + export NIXOS_NO_CHECK=1 + ''} nix-env -p /nix/var/nix/profiles/system --set "$system" "$system"/bin/switch-to-configuration ${switch} else @@ -503,8 +507,13 @@ rec { old_gen=$(readlink -f /nix/var/nix/profiles/system) new_gen=$(readlink -f "$system") if [ "x$old_gen" != "x$new_gen" ]; then + ${lib.optionalString (switch == "switch") /* sh */ '' + "$system"/bin/switch-to-configuration check + export NIXOS_NO_CHECK=1 + ''} nix-env -p /nix/var/nix/profiles/system --set "$system" systemd-run --pipe --wait --collect --quiet \ + --setenv=NIXOS_NO_CHECK="''${NIXOS_NO_CHECK-}" \ "$system"/bin/switch-to-configuration ${switch} else echo 'Configuration is already up to date' >&2 |
