aboutsummaryrefslogtreecommitdiffstats
path: root/nix/module.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-12-01 06:05:30 +0000
committertv <tv@krebsco.de>2026-12-01 13:21:22 +0100
commit34ac5dbc20be127a3d6b332687efcc4816fbe70f (patch)
tree1b0b6ff3d3d76df5c8e12e228c59c500661d50b1 /nix/module.nix
parent5fb90d63fefe2566a24c9a5e45354198115986e9 (diff)
nix: the check before a switch runs for boot, too
A generation whose required slots the state can't fill doesn't become the next boot's default either: tools like Clan run switch-to-configuration boot before switch, so the check refused only once the generation was the boot default already. Staging a generation for a later reboot works by a submission waiting in incomingDir, which the check plans. dry-activate stays unchecked. A line of the VM test (not run).
Diffstat (limited to 'nix/module.nix')
-rw-r--r--nix/module.nix14
1 files changed, 8 insertions, 6 deletions
diff --git a/nix/module.nix b/nix/module.nix
index 3028df5..f7a51a9 100644
--- a/nix/module.nix
+++ b/nix/module.nix
@@ -289,8 +289,10 @@ in
description = ''
Whether a switch to a generation whose required slots the state can't fill,
even by migrating and with the submissions waiting in `incomingDir`, or for
- which a waiting submission is refused, is refused before switching. Not
- checked for `boot` and `dry-activate`.
+ which a waiting submission is refused, is refused before switching. Also
+ for `boot`: a generation that can't be served doesn't become the next boot's
+ default (tools like Clan run `boot` before `switch`); a submission for it
+ can wait in `incomingDir`. Not checked for `dry-activate`.
'';
};
};
@@ -372,13 +374,13 @@ in
};
};
- # With the new generation's enstate, schema and configuration; on a host without
- # enstate yet, too: its first switch needs its state, which can wait in
- # incomingDir.
+ # With the new generation's enstate, schema and configuration, also for `boot`,
+ # and on a host without enstate yet: its first switch needs its state, which can
+ # wait in incomingDir.
system.preSwitchChecks = lib.mkIf cfg.checkBeforeSwitch {
enstate = ''
case "''${2-}" in
- boot|dry-activate) exit 0 ;;
+ dry-activate) exit 0 ;;
esac
${enstate} --migrate --dry-run --schema "$1/etc/enstate/schema.json" --config "$1/etc/enstate/config.json"
'';