logrotate: default to enable if any rule is active

This commit is contained in:
Dominique Martinet 2022-02-11 17:13:38 +09:00
parent 9917af7fe0
commit 61c70dbc97
3 changed files with 14 additions and 1 deletions

View File

@ -865,6 +865,13 @@
Plugins are automatically repackaged using autoPatchelf.
</para>
</listitem>
<listitem>
<para>
<literal>services.logrotate.enable</literal> now defaults to
true if any rotate path has been defined, and some paths have
been added by default.
</para>
</listitem>
<listitem>
<para>
The <literal>zrepl</literal> package has been updated from

View File

@ -294,6 +294,9 @@ In addition to numerous new and upgraded packages, this release has the followin
- `services.mattermost.plugins` has been added to allow the declarative installation of Mattermost plugins.
Plugins are automatically repackaged using autoPatchelf.
- `services.logrotate.enable` now defaults to true if any rotate path has
been defined, and some paths have been added by default.
- The `zrepl` package has been updated from 0.4.0 to 0.5:
- The RPC protocol version was bumped; all zrepl daemons in a setup must be updated and restarted before replication can resume.

View File

@ -111,7 +111,10 @@ in
options = {
services.logrotate = {
enable = mkEnableOption "the logrotate systemd service";
enable = mkEnableOption "the logrotate systemd service" // {
default = foldr (n: a: a || n.enable) false (attrValues cfg.paths);
defaultText = literalExpression "cfg.paths != {}";
};
paths = mkOption {
type = with types; attrsOf (submodule pathOpts);