mirror of
https://github.com/ItsDrike/nixdots
synced 2024-11-10 08:19:42 +00:00
23 lines
515 B
Nix
23 lines
515 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";
|
|
lidSwitchExternalPower = "suspend";
|
|
extraConfig = ''
|
|
HandlePowerKey=suspend
|
|
HibernateDelaySec=3600
|
|
'';
|
|
};
|
|
};
|
|
}
|