about summary refs log tree commit diff
path: root/nixos/modules/services/logging
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2022-03-01 22:02:32 +0900
committerDominique Martinet <asmadeus@codewreck.org>2022-04-01 07:09:26 +0900
commit3cc8ea28d1c20320b674d3d4131d02e4df8df5fa (patch)
treee95d3100e5758ac220d0cd9f4a9ab53fdaf992b0 /nixos/modules/services/logging
parent3a2fa0d04928e67d20f10df75a60fa2ea0002a15 (diff)
logrotate: add services.logrotate.configFile escape hatch
Diffstat (limited to 'nixos/modules/services/logging')
-rw-r--r--nixos/modules/services/logging/logrotate.nix23
1 files changed, 22 insertions, 1 deletions
diff --git a/nixos/modules/services/logging/logrotate.nix b/nixos/modules/services/logging/logrotate.nix
index 7e32296c79098..d16a5a571ba32 100644
--- a/nixos/modules/services/logging/logrotate.nix
+++ b/nixos/modules/services/logging/logrotate.nix
@@ -122,6 +122,27 @@ in
         defaultText = literalExpression "cfg.paths != {}";
       };
 
+      configFile = mkOption {
+        type = types.path;
+        default = configFile;
+        defaultText = ''
+          A configuration file automatically generated by NixOS.
+        '';
+        description = ''
+          Override the configuration file used by MySQL. By default,
+          NixOS generates one automatically from <option>services.logrotate.settings</option>.
+        '';
+        example = literalExpression ''
+          pkgs.writeText "logrotate.conf" '''
+            missingok
+            "/var/log/*.log" {
+              rotate 4
+              weekly
+            }
+          ''';
+        '';
+      };
+
       paths = mkOption {
         type = with types; attrsOf (submodule pathOpts);
         default = { };
@@ -181,7 +202,7 @@ in
       serviceConfig = {
         Restart = "no";
         User = "root";
-        ExecStart = "${pkgs.logrotate}/sbin/logrotate ${mailOption} ${configFile}";
+        ExecStart = "${pkgs.logrotate}/sbin/logrotate ${mailOption} ${cfg.configFile}";
       };
     };
   };