diff --git a/hosts/common/systemd.nix b/hosts/common/systemd.nix index 0b74ec26..1ce41917 100644 --- a/hosts/common/systemd.nix +++ b/hosts/common/systemd.nix @@ -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: security.polkit.extraConfig = ''