logrotate: add services.logrotate.configFile escape hatch
This commit is contained in:
@@ -122,6 +122,27 @@ in
|
|||||||
defaultText = literalExpression "cfg.paths != {}";
|
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 {
|
paths = mkOption {
|
||||||
type = with types; attrsOf (submodule pathOpts);
|
type = with types; attrsOf (submodule pathOpts);
|
||||||
default = { };
|
default = { };
|
||||||
@@ -181,7 +202,7 @@ in
|
|||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Restart = "no";
|
Restart = "no";
|
||||||
User = "root";
|
User = "root";
|
||||||
ExecStart = "${pkgs.logrotate}/sbin/logrotate ${mailOption} ${configFile}";
|
ExecStart = "${pkgs.logrotate}/sbin/logrotate ${mailOption} ${cfg.configFile}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user