b47c2186f6
options 'enable' (cronjob every hour) and the config flie contents passed as a string. svn path=/nixos/trunk/; revision=21438
39 lines
652 B
Nix
39 lines
652 B
Nix
{config, pkgs, ...}:
|
|
|
|
with pkgs.lib;
|
|
|
|
let
|
|
cfg = config.services.logrotate;
|
|
|
|
configFile = pkgs.writeText "logrotate.conf"
|
|
cfg.config;
|
|
|
|
cronJob = ''
|
|
5 * * * * ${pkgs.logrotate}/sbin/logrotate ${configFile}
|
|
'';
|
|
|
|
in
|
|
{
|
|
options = {
|
|
services.logrotate = {
|
|
enable = mkOption {
|
|
default = false;
|
|
description = ''
|
|
Enable the logrotate cron job
|
|
'';
|
|
};
|
|
|
|
config = mkOption {
|
|
default = "";
|
|
description = ''
|
|
The contents of the logrotate config file
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
services.cron.systemCronJobs = [ cronJob ];
|
|
};
|
|
}
|