cron.nix: Use the new option scheme.

svn path=/nixos/trunk/; revision=13235
This commit is contained in:
Nicolas Pierron 2008-11-09 16:44:43 +00:00
parent 2e6c2f9aaf
commit 866987a60e
4 changed files with 73 additions and 46 deletions

View File

@ -626,29 +626,6 @@ in
}; };
cron = {
mailto = mkOption {
default = "";
description = " The job output will be mailed to this email address. ";
};
systemCronJobs = mkOption {
default = [];
example = [
"* * * * * test ls -l / > /tmp/cronout 2>&1"
"* * * * * eelco echo Hello World > /home/eelco/cronout"
];
description = ''
A list of Cron jobs to be appended to the system-wide
crontab. See the manual page for crontab for the expected
format. If you want to get the results mailed you must setuid
sendmail. See <option>security.setuidOwners</option>
'';
};
};
atd = { atd = {
enable = mkOption { enable = mkOption {
@ -3067,7 +3044,11 @@ root ALL=(ALL) SETENV: ALL
require = [ require = [
# newtworking # newtworking
(import ../upstart-jobs/dhclient.nix) (import ../upstart-jobs/dhclient.nix)
# hardware # hardware
(import ../upstart-jobs/pcmcia.nix) (import ../upstart-jobs/pcmcia.nix)
# services
(import ../upstart-jobs/cron.nix)
]; ];
} }

View File

@ -176,7 +176,6 @@ rec {
pkgs.bzip2 pkgs.bzip2
pkgs.coreutils pkgs.coreutils
pkgs.cpio pkgs.cpio
pkgs.cron
pkgs.curl pkgs.curl
pkgs.e2fsprogs pkgs.e2fsprogs
pkgs.findutils pkgs.findutils

View File

@ -1,7 +1,39 @@
{pkgs, config}: {pkgs, config}:
###### interface
let let
inherit (pkgs.lib) mkOption;
options = {
services = {
cron = {
mailto = mkOption {
default = "";
description = " The job output will be mailed to this email address. ";
};
systemCronJobs = mkOption {
default = [];
example = [
"* * * * * test ls -l / > /tmp/cronout 2>&1"
"* * * * * eelco echo Hello World > /home/eelco/cronout"
];
description = ''
A list of Cron jobs to be appended to the system-wide
crontab. See the manual page for crontab for the expected
format. If you want to get the results mailed you must setuid
sendmail. See <option>security.setuidOwners</option>
'';
};
};
};
};
in
###### implementation
let
# !!! This should be defined somewhere else. # !!! This should be defined somewhere else.
locatedb = "/var/cache/locatedb"; locatedb = "/var/cache/locatedb";
@ -27,25 +59,45 @@ let
in in
{ {
name = "cron"; require = [
# (import ../upstart-jobs/default.nix) # config.services.extraJobs
extraEtc = [ # (import ?) # config.time.timeZone
# The system-wide crontab. # (import ?) # config.environment.etc
{ source = systemCronJobsFile; # (import ?) # config.environment.extraPackages
target = "crontab"; # (import ?) # config.environment.cleanStart
mode = "0600"; # Cron requires this. options
}
]; ];
job = '' environment = {
description "Cron daemon" etc = [
# The system-wide crontab.
{ source = systemCronJobsFile;
target = "crontab";
mode = "0600"; # Cron requires this.
}
];
start on startup extraPackages =
stop on shutdown pkgs.lib.optional
(!config.environment.cleanStart)
pkgs.cron;
};
# Needed to interpret times in the local timezone. services = {
env TZ=${config.time.timeZone} extraJobs = [{
name = "cron";
respawn ${pkgs.cron}/sbin/cron -n job = ''
''; description "Cron daemon"
start on startup
stop on shutdown
# Needed to interpret times in the local timezone.
env TZ=${config.time.timeZone}
respawn ${pkgs.cron}/sbin/cron -n
'';
}];
};
} }

View File

@ -140,11 +140,6 @@ let
inherit config pkgs nix nixEnvVars; inherit config pkgs nix nixEnvVars;
}) })
# Cron daemon.
(import ../upstart-jobs/cron.nix {
inherit config pkgs;
})
# Name service cache daemon. # Name service cache daemon.
(import ../upstart-jobs/nscd.nix { (import ../upstart-jobs/nscd.nix {
inherit (pkgs) glibc; inherit (pkgs) glibc;