mirror of
https://github.com/ItsDrike/nixdots
synced 2024-11-14 04:07:18 +00:00
ItsDrike
b930b14cf2
This configures what happens on lid close (on battery / on AC) and control what happens on the power button press.
19 lines
534 B
Nix
19 lines
534 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
|
|
'';
|
|
};
|
|
};
|
|
}
|