feat(power): suspend-then-hibernate 1h on battery (#115)
All checks were successful
Check / eval (push) Successful in 6m16s
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:
@@ -226,6 +226,13 @@ in
|
||||
# system unit hooked to the sleep targets: it locks on the RAM-resume
|
||||
# sleeps always, and on hibernate only when the disk is unencrypted (no
|
||||
# LUKS gate to rely on). Replaces hypridle's old before_sleep_cmd.
|
||||
#
|
||||
# #115 suspend-then-hibernate: the first phase is RAM-resume (lock),
|
||||
# then after HibernateDelaySec systemd enters pure hibernate. Without
|
||||
# an unlock before that second phase, an encrypted resume would demand
|
||||
# LUKS *and* still-locked hyprlock. Drop the session lock immediately
|
||||
# before encrypted hibernate — LUKS is the gate; unencrypted still
|
||||
# locks via the unit below on hibernate.target.
|
||||
systemd.services.nomarchy-lock-before-sleep =
|
||||
let
|
||||
encrypted = builtins.attrNames config.boot.initrd.luks.devices != [ ];
|
||||
@@ -244,6 +251,20 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.nomarchy-unlock-before-encrypted-hibernate =
|
||||
let encrypted = builtins.attrNames config.boot.initrd.luks.devices != [ ];
|
||||
in lib.mkIf encrypted {
|
||||
description = "Unlock session before encrypted hibernate (LUKS is the resume gate)";
|
||||
before = [ "systemd-hibernate.service" ];
|
||||
wantedBy = [ "hibernate.target" ];
|
||||
# After lock-before-sleep on the s2h RAM phase; before the image.
|
||||
after = [ "nomarchy-lock-before-sleep.service" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${config.systemd.package}/bin/loginctl unlock-sessions";
|
||||
};
|
||||
};
|
||||
|
||||
# zsh as the default login shell (the desktop's shell experience —
|
||||
# starship/bat/eza/zoxide — is configured home-side in shell.nix).
|
||||
# programs.zsh.enable wires /etc/zshrc, completion and /etc/shells;
|
||||
|
||||
Reference in New Issue
Block a user