mirror of
https://github.com/ItsDrike/nixdots
synced 2024-12-25 19:24:34 +00:00
Configure power actions with logind
This configures what happens on lid close (on battery / on AC) and control what happens on the power button press.
This commit is contained in:
parent
6bbebb3cd2
commit
b930b14cf2
|
@ -4,6 +4,7 @@
|
||||||
./mount.nix
|
./mount.nix
|
||||||
./printing.nix
|
./printing.nix
|
||||||
./misc.nix
|
./misc.nix
|
||||||
|
./logind.nix
|
||||||
./gnome-keyring.nix
|
./gnome-keyring.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
18
system/roles/workstation/services/logind.nix
Normal file
18
system/roles/workstation/services/logind.nix
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{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
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue