summaryrefslogtreecommitdiffstats
path: root/krops.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-12-01 14:33:19 +0000
committertv <tv@krebsco.de>2026-12-01 14:33:19 +0000
commitf8baace71fcf773125d1cdb1f92865aaf60b73f9 (patch)
treeaa9e9e55370dd5bf9e00cf3f6552e2aef48c169f /krops.nix
parent7d7c3ead7ffc6e2796e17ef9a94c771738c5c3a7 (diff)
krops.nix: refuse the enstate action while the profile waits for a reboot
The running generation would plan the submissions, and refuse what only the profile's generation has a slot for; the reboot would find nothing to take.
Diffstat (limited to 'krops.nix')
-rw-r--r--krops.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/krops.nix b/krops.nix
index 322b7724..c4f4975b 100644
--- a/krops.nix
+++ b/krops.nix
@@ -255,6 +255,13 @@ rec {
${enstateSteps.packAndCopy}
${pkgs.krops.runShell (lib.mkTarget target) {} /* sh */ ''
set -efu
+ # The running generation isn't the profile's (after a deploy with boot,
+ # or test): it would plan what's meant for the one the next boot runs,
+ # and refuse what only that one has a slot for.
+ if [ "$(readlink -f /nix/var/nix/profiles/system)" != "$(readlink -f /run/current-system)" ]; then
+ echo "${name}: the running generation isn't the system profile's: reboot, or deploy" >&2
+ exit 1
+ fi
${enstateSteps.movePending}
/run/current-system/sw/bin/enstate --migrate
${enstateSteps.showStatus "/run/current-system"}