logrotate: add services.logrotate.configFile escape hatch

This commit is contained in:
Dominique Martinet
2022-03-01 22:02:32 +09:00
parent 3a2fa0d049
commit 3cc8ea28d1

View File

@@ -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}";
};
};
};