nixos: systemd-journald: use cfg shorthand
This commit is contained in:
parent
fee1e24b3b
commit
7adc8ecac3
1 changed files with 14 additions and 9 deletions
|
@ -1,5 +1,10 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
with lib; {
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.journald;
|
||||||
|
in {
|
||||||
options = {
|
options = {
|
||||||
services.journald.console = mkOption {
|
services.journald.console = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
|
@ -88,7 +93,7 @@ with lib; {
|
||||||
] ++ (optional (!config.boot.isContainer) "systemd-journald-audit.socket") ++ [
|
] ++ (optional (!config.boot.isContainer) "systemd-journald-audit.socket") ++ [
|
||||||
"systemd-journald-dev-log.socket"
|
"systemd-journald-dev-log.socket"
|
||||||
"syslog.socket"
|
"syslog.socket"
|
||||||
] ++ optionals config.services.journald.enableHttpGateway [
|
] ++ optionals cfg.enableHttpGateway [
|
||||||
"systemd-journal-gatewayd.socket"
|
"systemd-journal-gatewayd.socket"
|
||||||
"systemd-journal-gatewayd.service"
|
"systemd-journal-gatewayd.service"
|
||||||
];
|
];
|
||||||
|
@ -97,16 +102,16 @@ with lib; {
|
||||||
"systemd/journald.conf".text = ''
|
"systemd/journald.conf".text = ''
|
||||||
[Journal]
|
[Journal]
|
||||||
Storage=persistent
|
Storage=persistent
|
||||||
RateLimitInterval=${config.services.journald.rateLimitInterval}
|
RateLimitInterval=${cfg.rateLimitInterval}
|
||||||
RateLimitBurst=${toString config.services.journald.rateLimitBurst}
|
RateLimitBurst=${toString cfg.rateLimitBurst}
|
||||||
${optionalString (config.services.journald.console != "") ''
|
${optionalString (cfg.console != "") ''
|
||||||
ForwardToConsole=yes
|
ForwardToConsole=yes
|
||||||
TTYPath=${config.services.journald.console}
|
TTYPath=${cfg.console}
|
||||||
''}
|
''}
|
||||||
${optionalString (config.services.journald.forwardToSyslog) ''
|
${optionalString (cfg.forwardToSyslog) ''
|
||||||
ForwardToSyslog=yes
|
ForwardToSyslog=yes
|
||||||
''}
|
''}
|
||||||
${config.services.journald.extraConfig}
|
${cfg.extraConfig}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -116,7 +121,7 @@ with lib; {
|
||||||
users.groups.systemd-journal-gateway.gid = config.ids.gids.systemd-journal-gateway;
|
users.groups.systemd-journal-gateway.gid = config.ids.gids.systemd-journal-gateway;
|
||||||
|
|
||||||
systemd.sockets.systemd-journal-gatewayd.wantedBy =
|
systemd.sockets.systemd-journal-gatewayd.wantedBy =
|
||||||
optional config.services.journald.enableHttpGateway "sockets.target";
|
optional cfg.enableHttpGateway "sockets.target";
|
||||||
|
|
||||||
systemd.services.systemd-journal-flush.restartIfChanged = false;
|
systemd.services.systemd-journal-flush.restartIfChanged = false;
|
||||||
systemd.services.systemd-journald.restartTriggers = [ config.environment.etc."systemd/journald.conf".source ];
|
systemd.services.systemd-journald.restartTriggers = [ config.environment.etc."systemd/journald.conf".source ];
|
||||||
|
|
Loading…
Reference in a new issue