diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 89f8e815355..d1029bb5798 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -601,8 +601,27 @@ in
type = types.lines;
example = "IdleAction=lock";
description = ''
- Extra config options for systemd-logind. See man logind.conf for
- available options.
+ Extra config options for systemd-logind. See
+
+ logind.conf(5) for available options.
+ '';
+ };
+
+ services.logind.killUserProcesses = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ 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)), and processes are not killed.
+
+
+
+ See logind.conf(5)
+ for more details.
'';
};
@@ -771,7 +790,7 @@ in
"systemd/logind.conf".text = ''
[Login]
- KillUserProcesses=no
+ KillUserProcesses=${if config.services.logind.killUserProcesses then "yes" else "no"}
HandleLidSwitch=${config.services.logind.lidSwitch}
HandleLidSwitchDocked=${config.services.logind.lidSwitchDocked}
${config.services.logind.extraConfig}