nixdots/system/roles/workstation/services/logind.nix
2024-07-27 01:07:07 +02:00

23 lines
542 B
Nix

{
lib,
config,
...
}: let
inherit (lib) mkIf;
deviceType = config.myOptions.device.roles.type;
acceptedTypes = ["laptop" "desktop"];
in {
config = mkIf (builtins.elem deviceType acceptedTypes) {
# despite being under logind, this has nothing to do with login
# it's about power management
services.logind = {
lidSwitch = "suspend-then-hibernate";
lidSwitchExternalPower = "lock";
extraConfig = ''
HandlePowerKey=suspend-then-hibernate
HibernateDelaySec=3600
'';
};
};
}