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

@@ -123,36 +123,6 @@ the measured number, both ISOs built from one tree), installs successfully with
a network in a QEMU run, says clearly at boot that it needs one, and leaves the
offline ISO's behaviour untouched (`checks.*` for the offline path stay green).
### 115. Suspend-then-hibernate, with a way to set it up
Bernardo, 2026-07-14: a suspended laptop should be able to fall through to
hibernate after a while, so a bag-carried machine stops draining, and setting
that up must be easy — not a systemd-sleep man-page trip.
The mechanism is `systemd`'s `suspend-then-hibernate` plus
`HibernateDelaySec`; the work is the surfacing, and the constraints are
already in the tree. Hibernate needs the resume offset + swap the installer
detects (`resumeOffset`/`rootUuid` in patch-template.py) — on a machine
without them this must self-gate, not fail at suspend time, the way Battery
limit gates on a battery. `modules/nixos/default.nix` already declines to
hyprlock before an encrypted hibernate (the LUKS resume gates it); check that
reasoning still holds when the suspend leads to hibernate. Menu placement: it
belongs with the power settings, not the root (§ menu placement convention).
Settle first (`[human]`): whether the delay is a preset list (30 min / 1 h /
2 h / never) or a free-form entry, and whether it applies on battery only or
always — the same on-AC question `modules/home/idle.nix`'s suspend listener
already answers with `${onAc} ||`.
In-flake state like the rest (`settings.*`), menu-writable, and read via
`state-read.nix` on the NixOS side — NOT `config.nomarchy.settings`,
which does not exist there (ROADMAP § *NixOS-side state bridges (#116)*; copy
the `bluetooth.enable` shape in `modules/nixos/default.nix` and add a case to
`checks.state-bridges`). Pass = the toggle survives a rebuild,
a suspended machine hibernates after the configured delay and resumes, and a
machine without hibernate support hides the row instead of offering a
suspend that never wakes.
## LATER
- **Wallpapers artifact split** (ROADMAP § Faster switches — decided,