From bfd7ffcf087fc3f24dec05e988550a33e7f09340 Mon Sep 17 00:00:00 2001 From: Axel Karjalainen Date: Sat, 4 Apr 2026 20:04:10 +0300 Subject: [PATCH] nixos/stalwart: switch logging from stdout to journal journald's centralized logging has many advantages: - External centralized logging can simply source from journald - journald's auto-vacuum options (e.g. SystemMaxUse) can make sure logs don't take up too much space - Logs are in a single timeline, which is useful for analysis --- .../manual/release-notes/rl-2605.section.md | 1 + nixos/modules/services/mail/stalwart.nix | 28 +++++++++++++------ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-2605.section.md b/nixos/doc/manual/release-notes/rl-2605.section.md index a60462513ec7..7ce066cd0bf3 100644 --- a/nixos/doc/manual/release-notes/rl-2605.section.md +++ b/nixos/doc/manual/release-notes/rl-2605.section.md @@ -168,6 +168,7 @@ of pulling the upstream container image from Docker Hub. If you want the old beh - `systemd.services.stalwart` owned by `stalwart:stalwart`. The `user` and `group` are configurable via `services.stalwart.user` and `services.stalwart.group`, respectively. By default, if `stateVersion` is older than `26.05`, will fallback to legacy value of `stalwart-mail` for both `user` and `group`. - Default value for `services.stalwart.dataDir` has changed to `/var/lib/stalwart`. If `stateVersion` is older than `26.05`, will fallback to legacy value of `/var/lib/stalwart-mail`. + - Default tracer name and type have changed to `journal`. If `stateVersion` is older than `26.05`, will fallback to legacy value of `stdout`. - `services.eintopf` has been renamed to `services.lauti` to align with upstream re-brand as a community online calendar. diff --git a/nixos/modules/services/mail/stalwart.nix b/nixos/modules/services/mail/stalwart.nix index 624f37e8892a..b2c9cf141f8e 100644 --- a/nixos/modules/services/mail/stalwart.nix +++ b/nixos/modules/services/mail/stalwart.nix @@ -9,8 +9,8 @@ let configFormat = pkgs.formats.toml { }; configFile = configFormat.generate "stalwart.toml" cfg.settings; useLegacyStorage = lib.versionOlder cfg.stateVersion "24.11"; - useLegacyIdentifier = lib.versionOlder cfg.stateVersion "26.05"; - stalwartIdentifier = if useLegacyIdentifier then "stalwart-mail" else "stalwart"; + pre2605 = lib.versionOlder cfg.stateVersion "26.05"; + stalwartIdentifier = if pre2605 then "stalwart-mail" else "stalwart"; parsePorts = listeners: @@ -123,12 +123,24 @@ in # Default config: all local services.stalwart.settings = { - tracer.stdout = { - type = lib.mkDefault "stdout"; - level = lib.mkDefault "info"; - ansi = lib.mkDefault false; # no colour markers to journald - enable = lib.mkDefault true; - }; + tracer = + if pre2605 then + { + stdout = { + type = lib.mkDefault "stdout"; + level = lib.mkDefault "info"; + ansi = lib.mkDefault false; # no colour markers to journald + enable = lib.mkDefault true; + }; + } + else + { + journal = { + type = lib.mkDefault "journal"; + level = lib.mkDefault "info"; + enable = lib.mkDefault true; + }; + }; store = if useLegacyStorage then {