summary refs log tree commit diff
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2022-02-11 17:13:38 +0900
committerDominique Martinet <asmadeus@codewreck.org>2022-02-11 21:07:37 +0900
commit61c70dbc97b57188aa4c482cbb79171902e53c6e (patch)
tree6132a3706a6b7a372cf697700652559451b0042a
parent9917af7fe0e394d854a8e9548ac0a040cfc44621 (diff)
downloadnixpkgs-61c70dbc97b57188aa4c482cbb79171902e53c6e.tar
nixpkgs-61c70dbc97b57188aa4c482cbb79171902e53c6e.tar.gz
nixpkgs-61c70dbc97b57188aa4c482cbb79171902e53c6e.tar.bz2
nixpkgs-61c70dbc97b57188aa4c482cbb79171902e53c6e.tar.lz
nixpkgs-61c70dbc97b57188aa4c482cbb79171902e53c6e.tar.xz
nixpkgs-61c70dbc97b57188aa4c482cbb79171902e53c6e.tar.zst
nixpkgs-61c70dbc97b57188aa4c482cbb79171902e53c6e.zip
logrotate: default to enable if any rule is active
-rw-r--r--nixos/doc/manual/from_md/release-notes/rl-2205.section.xml7
-rw-r--r--nixos/doc/manual/release-notes/rl-2205.section.md3
-rw-r--r--nixos/modules/services/logging/logrotate.nix5
3 files changed, 14 insertions, 1 deletions
diff --git a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
index 544b1e13898..a96808014d5 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
@@ -867,6 +867,13 @@
       </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
           0.4.0 to 0.5:
         </para>
diff --git a/nixos/doc/manual/release-notes/rl-2205.section.md b/nixos/doc/manual/release-notes/rl-2205.section.md
index c748d2dae9e..1b627703989 100644
--- a/nixos/doc/manual/release-notes/rl-2205.section.md
+++ b/nixos/doc/manual/release-notes/rl-2205.section.md
@@ -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.
diff --git a/nixos/modules/services/logging/logrotate.nix b/nixos/modules/services/logging/logrotate.nix
index 26d22d90175..1467e27deba 100644
--- a/nixos/modules/services/logging/logrotate.nix
+++ b/nixos/modules/services/logging/logrotate.nix
@@ -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);