systemd: remove no-longer-used user@1000 override

This commit is contained in:
Colin 2024-05-29 11:42:16 +00:00
parent 35ff7de06e
commit 7c8a18ecbd

View File

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ ... }:
let
# N.B.: systemd doesn't like to honor its timeout settings.
# a timeout of 20s is actually closer to 70s,
@ -12,11 +12,6 @@ in
DefaultTimeoutStopSec=${builtins.toString haltTimeout}
'';
systemd.user.extraConfig = ''
# DefaultTimeoutStopSec defaults to 90s, and frequently blocks overall system shutdown.
DefaultTimeoutStopSec=${builtins.toString haltTimeout}
'';
services.journald.extraConfig = ''
# docs: `man journald.conf`
# merged journald config is deployed to /etc/systemd/journald.conf
@ -25,41 +20,6 @@ in
Compress=no
'';
# decreasing the timeout for the manager itself ("Stop job is running for User Manager for UID 1000").
# TimeoutStopSec gets stripped from .override file for `user@`, so can't do it that way:
# systemd.services."user@".serviceConfig.TimeoutStopSec = "20s";
# adding just TimeoutStopSec to `user@1000` causes it to lose all the other fields, including `ExecStart`:
# systemd.services."user@1000".serviceConfig.TimeoutStopSec = "20s";
# so, just recreate the whole damn service as it appears with `systemd cat 'user@1000'`
# and modify the parts i care about.
systemd.services."user@1000" = {
description = "User Manager for UID %i";
documentation = [ "man:user@service(5)" ];
after = [
"user-runtime-dir@%i.service"
"dbus.service"
"systemd-oomd.service"
];
requires = [ "user-runtime-dir@%i.service" ];
unitConfig.IgnoreOnIsolate = true;
serviceConfig = {
User = "%i";
PAMName = "systemd-user";
Type = "notify-reload";
ExecStart = "${pkgs.systemd}/lib/systemd/systemd --user";
Slice = "user-%i.slice";
KillMode = "mixed";
Delegate = [ "pids" "memory" "cpu" ];
DelegateSubgroup = "init.scope";
TasksMax = "infinity";
TimeoutStopSec = "${builtins.toString haltTimeout}s"; #< default: 120s
KeyringMode = "inherit";
OOMScoreAdjust = 100;
MemoryPressureWatch = "skip";
};
};
# allow ordinary users to `reboot` or `shutdown`.
# source: <https://nixos.wiki/wiki/Polkit>
security.polkit.extraConfig = ''