Skip to content

Commit

Permalink
services.logind: add options for lid-switch behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Ma27 committed May 23, 2017
1 parent 8131958 commit 23d1c7f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions nixos/modules/system/boot/systemd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,11 @@ let
'';
};

logindHandlerType = types.enum [
"ignore" "poweroff" "reboot" "halt" "kexec" "suspend"
"hibernate" "hybrid-sleep" "lock"
];

in

{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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}
'';

Expand Down

0 comments on commit 23d1c7f

Please sign in to comment.