summary refs log tree commit diff
path: root/nixos/modules/services/logging
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2022-02-11 17:27:06 +0900
committerDominique Martinet <asmadeus@codewreck.org>2022-02-11 21:07:37 +0900
commitc132bfaa19ea08cce7c261ab4f0bda42bfc76b48 (patch)
tree0349d5c40a033cb9ddaad298567791f3c8a13a46 /nixos/modules/services/logging
parentc7618fbd9b871eec58174c4e65ff22b2739ca6e9 (diff)
downloadnixpkgs-c132bfaa19ea08cce7c261ab4f0bda42bfc76b48.tar
nixpkgs-c132bfaa19ea08cce7c261ab4f0bda42bfc76b48.tar.gz
nixpkgs-c132bfaa19ea08cce7c261ab4f0bda42bfc76b48.tar.bz2
nixpkgs-c132bfaa19ea08cce7c261ab4f0bda42bfc76b48.tar.lz
nixpkgs-c132bfaa19ea08cce7c261ab4f0bda42bfc76b48.tar.xz
nixpkgs-c132bfaa19ea08cce7c261ab4f0bda42bfc76b48.tar.zst
nixpkgs-c132bfaa19ea08cce7c261ab4f0bda42bfc76b48.zip
logrotate: prepend extraConfig instead of postpending it
logrotate global options only affect rules following them - as such,
services.logrotate.extraConfig being added last makes the option only
useful for adding new paths but not for setting global options (e.g.
'dateext' so all logs are rotate with a date suffix).

Moving this first solves this problem, and we can then use this instead
of default paths config to append missingok/notifempty.
Diffstat (limited to 'nixos/modules/services/logging')
-rw-r--r--nixos/modules/services/logging/logrotate.nix10
1 files changed, 5 insertions, 5 deletions
diff --git a/nixos/modules/services/logging/logrotate.nix b/nixos/modules/services/logging/logrotate.nix
index 1467e27deba..77e4fc39598 100644
--- a/nixos/modules/services/logging/logrotate.nix
+++ b/nixos/modules/services/logging/logrotate.nix
@@ -84,10 +84,6 @@ let
     };
 
     config.name = name;
-    config.extraConfig = ''
-      missingok
-      notifempty
-    '';
   };
 
   mkConf = pathOpts: ''
@@ -101,7 +97,11 @@ let
   '';
 
   paths = sortProperties (attrValues (filterAttrs (_: pathOpts: pathOpts.enable) cfg.paths));
-  configFile = pkgs.writeText "logrotate.conf" (concatStringsSep "\n" ((map mkConf paths) ++ [ cfg.extraConfig ]));
+  configFile = pkgs.writeText "logrotate.conf" (
+    concatStringsSep "\n" (
+      [ "missingok" "notifempty" cfg.extraConfig ] ++ (map mkConf paths)
+    )
+  );
 
 in
 {