1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/nixos/modules/services/logging/logrotate.nix

42 lines
820 B
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.logrotate;
configFile = pkgs.writeText "logrotate.conf"
cfg.config;
in
{
options = {
services.logrotate = {
enable = mkEnableOption "the logrotate systemd service";
};
config = mkOption {
default = "";
2014-10-16 07:20:43 +01:00
type = types.lines;
description = ''
The contents of the logrotate config file
'';
};
};
};
config = mkIf cfg.enable {
2014-07-10 12:11:35 +01:00
systemd.services.logrotate = {
description = "Logrotate Service";
wantedBy = [ "multi-user.target" ];
startAt = "*-*-* *:05:00";
serviceConfig.Restart = "no";
serviceConfig.User = "root";
script = ''
exec ${pkgs.logrotate}/sbin/logrotate ${configFile}
'';
};
};
}