3
0
Fork 0
forked from mirrors/nixpkgs

services.logind: add options for lid-switch behavior

This commit is contained in:
Maximilian Bosch 2017-05-21 16:30:53 +02:00
parent 81319583bc
commit 23d1c7f474
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E

View file

@ -396,6 +396,11 @@ let
'';
};
logindHandlerType = types.enum [
"ignore" "poweroff" "reboot" "halt" "kexec" "suspend"
"hibernate" "hybrid-sleep" "lock"
];
in
{
@ -595,6 +600,27 @@ in
'';
};
services.logind.lidSwitch = mkOption {
default = "suspend";
example = "ignore";
type = logindHandlerType;
description = ''
Specifies what to be done when the laptop lid is closed.
'';
};
services.logind.lidSwitchDocked = mkOption {
default = "ignore";
example = "suspend";
type = logindHandlerType;
description = ''
Specifies what to be done when the laptop lid is closed
and another screen is added.
'';
};
systemd.user.extraConfig = mkOption {
default = "";
type = types.lines;
@ -721,6 +747,8 @@ in
"systemd/logind.conf".text = ''
[Login]
KillUserProcesses=no
HandleLidSwitch=${config.services.logind.lidSwitch}
HandleLidSwitchDocked=${config.services.logind.lidSwitchDocked}
${config.services.logind.extraConfig}
'';