Use generated upstart-job's tags for cron.
svn path=/nixos/branches/fix-style/; revision=13593
This commit is contained in:
parent
2f0e8e370a
commit
b47e6675b8
@ -34,6 +34,8 @@ in
|
|||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
let
|
let
|
||||||
|
inherit (config.services) jobsTags;
|
||||||
|
|
||||||
# Put all the system cronjobs together.
|
# Put all the system cronjobs together.
|
||||||
systemCronJobs =
|
systemCronJobs =
|
||||||
config.services.cron.systemCronJobs;
|
config.services.cron.systemCronJobs;
|
||||||
@ -79,8 +81,8 @@ in
|
|||||||
job = ''
|
job = ''
|
||||||
description "Cron daemon"
|
description "Cron daemon"
|
||||||
|
|
||||||
start on startup
|
start on ${jobsTags.system.start}
|
||||||
stop on shutdown
|
stop on ${jobsTags.system.stop}
|
||||||
|
|
||||||
# Needed to interpret times in the local timezone.
|
# Needed to interpret times in the local timezone.
|
||||||
env TZ=${config.time.timeZone}
|
env TZ=${config.time.timeZone}
|
||||||
|
@ -2,7 +2,19 @@
|
|||||||
|
|
||||||
###### interface
|
###### interface
|
||||||
let
|
let
|
||||||
inherit (pkgs.lib) mkOption;
|
inherit (pkgs.lib) mkOption mapAttrs getAttr fold
|
||||||
|
mergeListOption mergeTypedOption mergeAttrsWithFunc;
|
||||||
|
|
||||||
|
mergeTags = mergeTypedOption "jobs tag" (x: true)
|
||||||
|
(fold (mergeAttrsWithFunc (a: b:
|
||||||
|
if builtins.lessThan a.priority b.priority then b else a
|
||||||
|
)) { priority = 100; });
|
||||||
|
|
||||||
|
applyTags = mapAttrs (attrName: value:
|
||||||
|
let name = getAttr ["name"] attrName value; in {
|
||||||
|
start = getAttr ["start"] (name + "/started") value;
|
||||||
|
stop = getAttr ["stop"] (name + "/stop") value;
|
||||||
|
});
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
services = {
|
services = {
|
||||||
@ -24,6 +36,22 @@ let
|
|||||||
Additional Upstart jobs.
|
Additional Upstart jobs.
|
||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# this attribute must be computed before extraJobs.
|
||||||
|
jobsTags = mkOption {
|
||||||
|
default = {};
|
||||||
|
example = {
|
||||||
|
newtworkInterface = {
|
||||||
|
name = "gw6c";
|
||||||
|
priority = 5;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
description = "
|
||||||
|
Allow jobs to overload jobs tags used by upstart jobs.
|
||||||
|
";
|
||||||
|
merge = mergeTags;
|
||||||
|
apply = applyTags;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
tests = {
|
tests = {
|
||||||
@ -480,6 +508,16 @@ in
|
|||||||
pkgs.lib.concatLists (map (job: job.groups) jobs);
|
pkgs.lib.concatLists (map (job: job.groups) jobs);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
jobsTags = {
|
||||||
|
system = {
|
||||||
|
priority = 0;
|
||||||
|
start = "startup";
|
||||||
|
stop = "shutdown";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
tests = {
|
tests = {
|
||||||
# see test/test-upstart-job.sh
|
# see test/test-upstart-job.sh
|
||||||
upstartJobs = { recurseForDerivations = true; } //
|
upstartJobs = { recurseForDerivations = true; } //
|
||||||
|
Loading…
x
Reference in New Issue
Block a user