From c132bfaa19ea08cce7c261ab4f0bda42bfc76b48 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Fri, 11 Feb 2022 17:27:06 +0900 Subject: 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. --- nixos/modules/services/logging/logrotate.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'nixos/modules/services/logging') 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 { -- cgit 1.4.1