feat(power): suspend-then-hibernate 1h on battery (#115)
All checks were successful
Check / eval (push) Successful in 6m16s

Human decision: 1h delay, battery only, Preferences enable/disable.
Wire systemd suspend-then-hibernate + HibernateDelaySec=1h +
HibernateOnACPower=false when settings.power.suspendThenHibernate is on
and boot.resumeDevice is set. Lid: s2h undocked, plain suspend on AC.
nomarchy-suspend for hypridle + Power menu (live state). LUKS unlock
before encrypted hibernate so s2h→disk is not double-password.
state-bridges assert the policy; HARDWARE-QUEUE #115 + suggested order.

V1: nix flake check --no-build. V3: bag-carry on hardware.
This commit is contained in:
2026-07-15 12:13:23 +01:00
parent e9dd3d14c5
commit 52d1581131
13 changed files with 304 additions and 51 deletions

View File

@@ -143,6 +143,26 @@
Needs nomarchy.system.power.laptop.
'';
};
# #115: suspend → hibernate after 1h on battery. Default true so a
# bag-carried laptop stops draining without a menu trip; Preferences
# flips settings.power.suspendThenHibernate (state bridge). No-op
# when boot.resumeDevice is unset (no hibernate path).
suspendThenHibernate = lib.mkOption {
type = lib.types.bool;
default = true;
defaultText = lib.literalExpression
"(settings.power.suspendThenHibernate from state.json) or true";
description = ''
When true and hibernation is wired (boot.resumeDevice), idle and
undocked lid-close use systemd suspend-then-hibernate on battery:
sleep, then hibernate after HibernateDelaySec (1 hour). On AC,
plain suspend only (HibernateOnACPower=false; lid uses
HandleLidSwitchExternalPower=suspend). Toggle from System
Preferences Suspend then hibernate needs a system rebuild for
logind; nomarchy-suspend reads the live state for menu/hypridle.
'';
};
};
};
}