mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-29 09:04:17 +00:00
65a4991eee
svn path=/nixos/trunk/; revision=21479
39 lines
657 B
Nix
39 lines
657 B
Nix
{config, pkgs, ...}:
|
|
|
|
with pkgs.lib;
|
|
|
|
let
|
|
cfg = config.services.logrotate;
|
|
|
|
configFile = pkgs.writeText "logrotate.conf"
|
|
cfg.config;
|
|
|
|
cronJob = ''
|
|
5 * * * * root ${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 ];
|
|
};
|
|
}
|