···
+
options.services.logind = {
+
extraConfig = mkOption {
example = "IdleAction=lock";
description = lib.mdDoc ''
+
Extra config options for systemd-logind.
+
See [logind.conf(5)](https://www.freedesktop.org/software/systemd/man/logind.conf.html)
+
killUserProcesses = mkOption {
description = lib.mdDoc ''
Specifies whether the processes of a user should be killed
when the user logs out. If true, the scope unit corresponding
to the session and all processes inside that scope will be
+
terminated. If false, the scope is "abandoned"
+
(see [systemd.scope(5)](https://www.freedesktop.org/software/systemd/man/systemd.scope.html#)),
+
and processes are not killed.
See [logind.conf(5)](https://www.freedesktop.org/software/systemd/man/logind.conf.html#KillUserProcesses=)
+
type = logindHandlerType;
+
description = lib.mdDoc ''
+
Specifies what to do when the power key is pressed.
+
powerKeyLongPress = mkOption {
+
type = logindHandlerType;
+
description = lib.mdDoc ''
+
Specifies what to do when the power key is long-pressed.
+
type = logindHandlerType;
+
description = lib.mdDoc ''
+
Specifies what to do when the reboot key is pressed.
+
rebootKeyLongPress = mkOption {
+
type = logindHandlerType;
+
description = lib.mdDoc ''
+
Specifies what to do when the reboot key is long-pressed.
+
suspendKey = mkOption {
type = logindHandlerType;
description = lib.mdDoc ''
+
Specifies what to do when the suspend key is pressed.
+
suspendKeyLongPress = mkOption {
+
type = logindHandlerType;
+
description = lib.mdDoc ''
+
Specifies what to do when the suspend key is long-pressed.
+
hibernateKey = mkOption {
+
type = logindHandlerType;
+
description = lib.mdDoc ''
+
Specifies what to do when the hibernate key is pressed.
+
hibernateKeyLongPress = mkOption {
type = logindHandlerType;
description = lib.mdDoc ''
+
Specifies what to do when the hibernate key is long-pressed.
+
type = logindHandlerType;
+
description = lib.mdDoc ''
+
Specifies what to do when the laptop lid is closed.
+
lidSwitchExternalPower = mkOption {
defaultText = literalExpression "services.logind.lidSwitch";
type = logindHandlerType;
description = lib.mdDoc ''
+
Specifies what to do when the laptop lid is closed
+
and the system is on external power. By default use
+
the same action as specified in services.logind.lidSwitch.
+
lidSwitchDocked = mkOption {
+
type = logindHandlerType;
+
description = lib.mdDoc ''
+
Specifies what to do when the laptop lid is closed
+
and another screen is added.
···
"systemd/logind.conf".text = ''
KillUserProcesses=${if cfg.killUserProcesses then "yes" else "no"}
+
HandlePowerKey=${cfg.powerKey}
+
HandlePowerKeyLongPress=${cfg.powerKeyLongPress}
+
HandleRebootKey=${cfg.rebootKey}
+
HandleRebootKeyLongPress=${cfg.rebootKeyLongPress}
+
HandleSuspendKey=${cfg.suspendKey}
+
HandleSuspendKeyLongPress=${cfg.suspendKeyLongPress}
+
HandleHibernateKey=${cfg.hibernateKey}
+
HandleHibernateKeyLongPress=${cfg.hibernateKeyLongPress}
HandleLidSwitch=${cfg.lidSwitch}
HandleLidSwitchExternalPower=${cfg.lidSwitchExternalPower}
+
HandleLidSwitchDocked=${cfg.lidSwitchDocked}