diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2017-05-21 16:30:53 +0200 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2017-05-23 18:57:57 +0200 |
commit | 23d1c7f4749c44f25817adcb418aaad476213eef (patch) | |
tree | b62ad95e68a89a78c5aea86f12626f02389675da /nixos/modules/system | |
parent | 81319583bc5e12e7d9e10d2bfd005914cd717598 (diff) |
services.logind: add options for lid-switch behavior
Diffstat (limited to 'nixos/modules/system')
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index f798862513cbc..00d6d370dd759 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -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} ''; |