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 = {
enable = mkOption {
@ -3067,7 +3044,11 @@ root ALL=(ALL) SETENV: ALL
require = [
# newtworking
(import ../upstart-jobs/dhclient.nix)
# hardware
(import ../upstart-jobs/pcmcia.nix)
# services
(import ../upstart-jobs/cron.nix)
];
}

View File

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

View File

@ -1,7 +1,39 @@
{pkgs, config}:
###### interface
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.
locatedb = "/var/cache/locatedb";
@ -25,27 +57,47 @@ let
'';
in
{
name = "cron";
extraEtc = [
# The system-wide crontab.
{ source = systemCronJobsFile;
target = "crontab";
mode = "0600"; # Cron requires this.
}
require = [
# (import ../upstart-jobs/default.nix) # config.services.extraJobs
# (import ?) # config.time.timeZone
# (import ?) # config.environment.etc
# (import ?) # config.environment.extraPackages
# (import ?) # config.environment.cleanStart
options
];
job = ''
description "Cron daemon"
environment = {
etc = [
# The system-wide crontab.
{ source = systemCronJobsFile;
target = "crontab";
mode = "0600"; # Cron requires this.
}
];
start on startup
stop on shutdown
extraPackages =
pkgs.lib.optional
(!config.environment.cleanStart)
pkgs.cron;
};
# Needed to interpret times in the local timezone.
env TZ=${config.time.timeZone}
services = {
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;
})
# Cron daemon.
(import ../upstart-jobs/cron.nix {
inherit config pkgs;
})
# Name service cache daemon.
(import ../upstart-jobs/nscd.nix {
inherit (pkgs) glibc;