nixpkgs/upstart-jobs/cron.nix
Eelco Dolstra 9f62e1a6a5 * Declarative specification of the system cron jobs. Ideally
this would abstract over the Crontab syntax though.

svn path=/nixos/trunk/; revision=10447
2008-02-01 12:01:27 +00:00

36 lines
607 B
Nix

{pkgs, config}:
let
systemCronJobs = config.services.cron.systemCronJobs;
systemCronJobsFile = pkgs.writeText "system-crontab" ''
SHELL=${pkgs.bash}/bin/sh
PATH=${pkgs.coreutils}/bin
MAILTO=
${pkgs.lib.concatStrings (map (job: job + "\n") systemCronJobs)}
'';
in
{
name = "cron";
extraEtc = [
# The system-wide crontab.
{ source = systemCronJobsFile;
target = "crontab";
mode = "0600"; # Cron requires this.
}
];
job = ''
description "Cron daemon"
start on startup
stop on shutdown
respawn ${pkgs.cron}/sbin/cron -n
'';
}