nixos/journald: add storage option

While this can be added via `services.journald.extraConfig`, this option
provides proper type-checking and other modules can determine
where journal data is stored. This is relevant when using e.g. promtail
to send logs to Loki and it should read from `/run/log/journal` if
volatile storage is used.
This commit is contained in:
Maximilian Bosch 2023-11-03 18:21:50 +01:00 committed by Bjørn Forsman
parent df4f0296d7
commit 0597d1d179

View File

@ -28,6 +28,15 @@ in {
'';
};
services.journald.storage = mkOption {
default = "persistent";
type = types.enum [ "persistent" "volatile" "auto" "none" ];
description = mdDoc ''
Controls where to store journal data. See
{manpage}`journald.conf(5)` for further information.
'';
};
services.journald.rateLimitBurst = mkOption {
default = 10000;
type = types.int;
@ -100,7 +109,7 @@ in {
environment.etc = {
"systemd/journald.conf".text = ''
[Journal]
Storage=persistent
Storage=${cfg.storage}
RateLimitInterval=${cfg.rateLimitInterval}
RateLimitBurst=${toString cfg.rateLimitBurst}
${optionalString (cfg.console != "") ''