summary refs log tree commit diff
diff options
context:
space:
mode:
authorajs124 <git@ajs124.de>2023-08-28 18:39:38 +0200
committerajs124 <git@ajs124.de>2023-09-05 16:04:07 +0200
commit6de832b0e5136e8a22e55ce9db5b2e3ad3164466 (patch)
tree5985d7c149abefa32ce63718e7b9c2b5a7887b29
parent41f13e856c7e7c51aaedcc9b61f9e93f56d5d805 (diff)
downloadnixpkgs-6de832b0e5136e8a22e55ce9db5b2e3ad3164466.tar
nixpkgs-6de832b0e5136e8a22e55ce9db5b2e3ad3164466.tar.gz
nixpkgs-6de832b0e5136e8a22e55ce9db5b2e3ad3164466.tar.bz2
nixpkgs-6de832b0e5136e8a22e55ce9db5b2e3ad3164466.tar.lz
nixpkgs-6de832b0e5136e8a22e55ce9db5b2e3ad3164466.tar.xz
nixpkgs-6de832b0e5136e8a22e55ce9db5b2e3ad3164466.tar.zst
nixpkgs-6de832b0e5136e8a22e55ce9db5b2e3ad3164466.zip
nixos/logrotate: add extraArgs option
-rw-r--r--nixos/modules/services/logging/logrotate.nix12
1 files changed, 9 insertions, 3 deletions
diff --git a/nixos/modules/services/logging/logrotate.nix b/nixos/modules/services/logging/logrotate.nix
index 342ac5ec6e0..ba1445f0839 100644
--- a/nixos/modules/services/logging/logrotate.nix
+++ b/nixos/modules/services/logging/logrotate.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, pkgs, utils, ... }:
 
 with lib;
 
@@ -220,6 +220,12 @@ in
           in this case you can disable the failing check with this option.
         '';
       };
+
+      extraArgs = lib.mkOption {
+        type = lib.types.listOf lib.types.str;
+        default = [];
+        description = "Additional command line arguments to pass on logrotate invocation";
+      };
     };
   };
 
@@ -231,7 +237,7 @@ in
       serviceConfig = {
         Restart = "no";
         User = "root";
-        ExecStart = "${pkgs.logrotate}/sbin/logrotate ${mailOption} ${cfg.configFile}";
+        ExecStart = "${pkgs.logrotate}/sbin/logrotate ${utils.escapeSystemdExecArgs cfg.extraArgs} ${mailOption} ${cfg.configFile}";
       };
     };
     systemd.services.logrotate-checkconf = {
@@ -240,7 +246,7 @@ in
       serviceConfig = {
         Type = "oneshot";
         RemainAfterExit = true;
-        ExecStart = "${pkgs.logrotate}/sbin/logrotate --debug ${cfg.configFile}";
+        ExecStart = "${pkgs.logrotate}/sbin/logrotate ${utils.escapeSystemdExecArgs cfg.extraArgs} --debug ${cfg.configFile}";
       };
     };
   };