Files
Nomarchy/core/system/hibernate.nix
Bernardo Magri 6238f41e43 fix(hibernate): mkDefault on HandlePowerKey / IdleAction / IdleActionSec
These three settings.Login fields were set at default priority, so a
downstream system.nix that wrote (e.g.) `services.logind.settings.Login.HandlePowerKey = "poweroff"`
would collide with Nomarchy's value instead of overriding it. Same
mkDefault treatment as the other lid-switch settings in this block.

Found during Pillar 8 audit of core/system modules.
2026-05-19 19:13:23 +01:00

25 lines
735 B
Nix

{ config, lib, ... }:
let
cfg = config.nomarchy.system.hibernation;
in
{
config = lib.mkIf cfg.enable {
# Wait this long after suspend before hibernating, and use the same
# delay as the idle-action timeout so the two paths agree.
systemd.sleep.extraConfig = ''
HibernateDelaySec=${toString (cfg.idleMinutes * 60)}
'';
services.logind = {
settings.Login = {
HandleLidSwitch = lib.mkDefault "suspend-then-hibernate";
HandleLidSwitchExternalPower = lib.mkDefault "suspend";
HandlePowerKey = lib.mkDefault "hibernate";
IdleAction = lib.mkDefault "suspend-then-hibernate";
IdleActionSec = lib.mkDefault (toString (cfg.idleMinutes * 60));
};
};
};
}