From 82133a8f169a887b6c46ea9790a97118b62e9434 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 4 Jun 2024 14:09:58 +0000 Subject: [PATCH] refactor: move logind config into systemd.nix --- hosts/common/hardware/default.nix | 7 ------- hosts/common/systemd.nix | 33 +++++++++++++++++++------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/hosts/common/hardware/default.nix b/hosts/common/hardware/default.nix index 12a52524..f88c31e5 100644 --- a/hosts/common/hardware/default.nix +++ b/hosts/common/hardware/default.nix @@ -80,13 +80,6 @@ # - query details with `sudo cpupower frequency-info` powerManagement.cpuFreqGovernor = "ondemand"; - # see: `man logind.conf` - # don’t shutdown when power button is short-pressed (commonly done an accident, or by cats). - # but do on long-press: useful to gracefully power-off server. - services.logind.powerKey = "lock"; - services.logind.powerKeyLongPress = "poweroff"; - services.logind.lidSwitch = "lock"; - # services.snapper.configs = { # root = { # subvolume = "/"; diff --git a/hosts/common/systemd.nix b/hosts/common/systemd.nix index 1ce41917..6fa981f1 100644 --- a/hosts/common/systemd.nix +++ b/hosts/common/systemd.nix @@ -7,19 +7,6 @@ let haltTimeout = 10; in { - systemd.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 - [Journal] - # disable journal compression because the underlying fs is compressed - Compress=no - ''; - # allow ordinary users to `reboot` or `shutdown`. # source: security.polkit.extraConfig = '' @@ -38,4 +25,24 @@ in } }) ''; + + services.journald.extraConfig = '' + # docs: `man journald.conf` + # merged journald config is deployed to /etc/systemd/journald.conf + [Journal] + # disable journal compression because the underlying fs is compressed + Compress=no + ''; + + # see: `man logind.conf` + # don’t shutdown when power button is short-pressed (commonly done an accident, or by cats). + # but do on long-press: useful to gracefully power-off server. + services.logind.powerKey = "lock"; + services.logind.powerKeyLongPress = "poweroff"; + services.logind.lidSwitch = "lock"; + + systemd.extraConfig = '' + # DefaultTimeoutStopSec defaults to 90s, and frequently blocks overall system shutdown. + DefaultTimeoutStopSec=${builtins.toString haltTimeout} + ''; }