Add the computation of upstart-packages inside the job sub-module by adding
the option named "upstartPkg". Move the obsolete option "services.extraJobs" to the rename module. svn path=/nixos/trunk/; revision=17672
This commit is contained in:
parent
824e94cf0a
commit
2969f36b15
@ -71,5 +71,6 @@ in zipModules ([]
|
|||||||
++ rename obsolete "boot.bootMount" to "boot.loader.grub.bootDevice"
|
++ rename obsolete "boot.bootMount" to "boot.loader.grub.bootDevice"
|
||||||
++ rename obsolete "boot.grubSplashImage" to "boot.loader.grub.splashImage"
|
++ rename obsolete "boot.grubSplashImage" to "boot.loader.grub.splashImage"
|
||||||
|
|
||||||
|
++ rename obsolete "services.extraJobs" to "jobs"
|
||||||
|
|
||||||
) # do not add renaming after this.
|
) # do not add renaming after this.
|
||||||
|
@ -75,9 +75,19 @@ let
|
|||||||
|
|
||||||
|
|
||||||
jobs =
|
jobs =
|
||||||
[pkgs.upstart] # for the built-in logd job
|
let
|
||||||
++ (map makeJob (mapAttrsFlatten (name: job: job // { inherit name; } ) config.jobAttrs));
|
deprecatedJobDefs = config.jobs;
|
||||||
|
jobList = concatStringsSep ", " (map (j: j.name) deprecatedJobDefs);
|
||||||
|
jobs =
|
||||||
|
if deprecatedJobDefs != [] then
|
||||||
|
builtins.trace "Make the following jobs use jobAttrs please. Using jobs is depreceated: ${jobList}" deprecatedJobDefs
|
||||||
|
else
|
||||||
|
deprecatedJobDefs;
|
||||||
|
in
|
||||||
|
[pkgs.upstart] # for the built-in logd job
|
||||||
|
++ map (job: job.upstartPkg) (attrValues config.jobAttrs)
|
||||||
|
++ map (job: job.upstartPkg) jobs;
|
||||||
|
|
||||||
# Create an etc/event.d directory containing symlinks to the
|
# Create an etc/event.d directory containing symlinks to the
|
||||||
# specified list of Upstart job files.
|
# specified list of Upstart job files.
|
||||||
jobsDir = pkgs.runCommand "upstart-jobs" {inherit jobs;}
|
jobsDir = pkgs.runCommand "upstart-jobs" {inherit jobs;}
|
||||||
@ -94,9 +104,11 @@ let
|
|||||||
done
|
done
|
||||||
''; # */
|
''; # */
|
||||||
|
|
||||||
listJobOptions = {
|
# !! remove extra indentations.
|
||||||
|
jobOptions = {
|
||||||
|
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
|
# !!! The type should ensure that this could be a filename.
|
||||||
type = types.string;
|
type = types.string;
|
||||||
example = "sshd";
|
example = "sshd";
|
||||||
description = ''
|
description = ''
|
||||||
@ -234,7 +246,26 @@ let
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
attrJobOptions = builtins.removeAttrs listJobOptions ["name"];
|
upstartJob = {name, config, ...}: {
|
||||||
|
options = {
|
||||||
|
upstartPkg = mkOption {
|
||||||
|
default = makeJob config;
|
||||||
|
type = types.uniq types.package;
|
||||||
|
description = ''
|
||||||
|
Upstart package which contains upstart events inside
|
||||||
|
<filename>/etc/event.d/</filename>. The default value is
|
||||||
|
generated from other options.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
# The default name is the name extracted from the attribute path.
|
||||||
|
name = mkDefaultValue (
|
||||||
|
replaceChars ["<" ">" "*"] ["_" "_" "_name_"] name
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
@ -257,8 +288,8 @@ in
|
|||||||
config.jobAttrs.sshd.startOn = "never";
|
config.jobAttrs.sshd.startOn = "never";
|
||||||
'';
|
'';
|
||||||
|
|
||||||
options = attrJobOptions;
|
|
||||||
type = types.attrsOf types.optionSet;
|
type = types.attrsOf types.optionSet;
|
||||||
|
options = [ jobOptions upstartJob ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -269,16 +300,7 @@ in
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
type = types.list types.optionSet;
|
type = types.list types.optionSet;
|
||||||
|
options = [ jobOptions upstartJob ];
|
||||||
options = listJobOptions;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
services.extraJobs = mkOption {
|
|
||||||
default = [];
|
|
||||||
description = ''
|
|
||||||
Obsolete - don't use.
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
tests.upstartJobs = mkOption {
|
tests.upstartJobs = mkOption {
|
||||||
@ -298,16 +320,6 @@ in
|
|||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
||||||
# add jobs of list style. If there are some print deprecation message
|
|
||||||
jobAttrs =
|
|
||||||
let deprecatedJobDefs = config.jobs ++ config.services.extraJobs;
|
|
||||||
jobList = concatStringsSep ", " (map (j: j.name) deprecatedJobDefs);
|
|
||||||
jobs = if deprecatedJobDefs != [] then
|
|
||||||
builtins.trace "Make the following jobs use jobAttrs please. Using jobs is depreceated: ${jobList}"
|
|
||||||
deprecatedJobDefs
|
|
||||||
else deprecatedJobDefs;
|
|
||||||
in builtins.listToAttrs (map (job: { inherit (job) name; value = builtins.removeAttrs job ["name"]; }) jobs);
|
|
||||||
|
|
||||||
environment.etc =
|
environment.etc =
|
||||||
[ { # The Upstart events defined above.
|
[ { # The Upstart events defined above.
|
||||||
source = "${jobsDir}/etc/event.d";
|
source = "${jobsDir}/etc/event.d";
|
||||||
@ -317,9 +329,10 @@ in
|
|||||||
|
|
||||||
# see test/test-upstart-job.sh (!!! check whether this still works)
|
# see test/test-upstart-job.sh (!!! check whether this still works)
|
||||||
tests.upstartJobs = { recurseForDerivations = true; } //
|
tests.upstartJobs = { recurseForDerivations = true; } //
|
||||||
builtins.listToAttrs (map (job:
|
builtins.listToAttrs (map (job: {
|
||||||
{ name = if job ? jobName then job.jobName else job.name; value = job; }
|
name = removePrefix "upstart-" job.name;
|
||||||
) jobs);
|
value = job;
|
||||||
|
}) jobs);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user