mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
Adding logrotate to nixos. Not a very clever logrotate, though:
options 'enable' (cronjob every hour) and the config flie contents passed as a string. svn path=/nixos/trunk/; revision=21438
This commit is contained in:
parent
a4516ec98a
commit
b47c2186f6
@ -53,6 +53,7 @@
|
||||
./services/hardware/pcscd.nix
|
||||
./services/hardware/udev.nix
|
||||
./services/logging/klogd.nix
|
||||
./services/logging/logrotate.nix
|
||||
./services/logging/syslogd.nix
|
||||
./services/mail/dovecot.nix
|
||||
./services/mail/postfix.nix
|
||||
|
38
modules/services/logging/logrotate.nix
Normal file
38
modules/services/logging/logrotate.nix
Normal file
@ -0,0 +1,38 @@
|
||||
{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 ];
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user