From 10f90010255643c2f48d73bc45ec6467f6afc45d Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 30 Nov 2026 18:23:58 +0000 Subject: 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. --- krops.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/krops.nix b/krops.nix index 6a8c967e..4e531132 100644 --- a/krops.nix +++ b/krops.nix @@ -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 -- cgit v1.3.1