mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 07:13:23 +01:00
nixos: systemd-logind: use cfg shorthand
This commit is contained in:
parent
c647002a94
commit
e2cb8903da
1 changed files with 8 additions and 6 deletions
|
@ -3,6 +3,8 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
cfg = config.services.logind;
|
||||||
|
|
||||||
logindHandlerType = types.enum [
|
logindHandlerType = types.enum [
|
||||||
"ignore" "poweroff" "reboot" "halt" "kexec" "suspend"
|
"ignore" "poweroff" "reboot" "halt" "kexec" "suspend"
|
||||||
"hibernate" "hybrid-sleep" "suspend-then-hibernate" "lock"
|
"hibernate" "hybrid-sleep" "suspend-then-hibernate" "lock"
|
||||||
|
@ -61,7 +63,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
services.logind.lidSwitchExternalPower = mkOption {
|
services.logind.lidSwitchExternalPower = mkOption {
|
||||||
default = config.services.logind.lidSwitch;
|
default = cfg.lidSwitch;
|
||||||
defaultText = literalExpression "services.logind.lidSwitch";
|
defaultText = literalExpression "services.logind.lidSwitch";
|
||||||
example = "ignore";
|
example = "ignore";
|
||||||
type = logindHandlerType;
|
type = logindHandlerType;
|
||||||
|
@ -90,11 +92,11 @@ in
|
||||||
environment.etc = {
|
environment.etc = {
|
||||||
"systemd/logind.conf".text = ''
|
"systemd/logind.conf".text = ''
|
||||||
[Login]
|
[Login]
|
||||||
KillUserProcesses=${if config.services.logind.killUserProcesses then "yes" else "no"}
|
KillUserProcesses=${if cfg.killUserProcesses then "yes" else "no"}
|
||||||
HandleLidSwitch=${config.services.logind.lidSwitch}
|
HandleLidSwitch=${cfg.lidSwitch}
|
||||||
HandleLidSwitchDocked=${config.services.logind.lidSwitchDocked}
|
HandleLidSwitchDocked=${cfg.lidSwitchDocked}
|
||||||
HandleLidSwitchExternalPower=${config.services.logind.lidSwitchExternalPower}
|
HandleLidSwitchExternalPower=${cfg.lidSwitchExternalPower}
|
||||||
${config.services.logind.extraConfig}
|
${cfg.extraConfig}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue