3
0
Fork 0
forked from mirrors/nixpkgs

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";
@ -27,9 +59,17 @@ let
in
{
name = "cron";
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
];
extraEtc = [
environment = {
etc = [
# The system-wide crontab.
{ source = systemCronJobsFile;
target = "crontab";
@ -37,6 +77,16 @@ in
}
];
extraPackages =
pkgs.lib.optional
(!config.environment.cleanStart)
pkgs.cron;
};
services = {
extraJobs = [{
name = "cron";
job = ''
description "Cron daemon"
@ -48,4 +98,6 @@ in
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;