nixos/systemd: let journald create /var/log/journal

The default value for journald's Storage option is "auto", which
determines whether to log to /var/log/journal based on whether that
directory already exists. So NixOS has been unconditionally creating
that directory in activation scripts.

However, we can get the same behavior by configuring journald.conf to
set Storage to "persistent" instead. In that case, journald will create
the directory itself if necessary.
This commit is contained in:
Jamey Sharp 2018-09-29 12:16:45 -07:00
parent 8d40083690
commit 10e8650515

View File

@ -747,6 +747,7 @@ in
"systemd/journald.conf".text = ''
[Journal]
Storage=persistent
RateLimitInterval=${config.services.journald.rateLimitInterval}
RateLimitBurst=${toString config.services.journald.rateLimitBurst}
${optionalString (config.services.journald.console != "") ''
@ -786,10 +787,6 @@ in
system.activationScripts.systemd =
''
mkdir -m 0755 -p /var/lib/udev
# Keep a persistent journal. Note that systemd-tmpfiles will
# set proper ownership/permissions.
mkdir -m 0700 -p /var/log/journal
'';
users.users.systemd-network.uid = config.ids.uids.systemd-network;