* Set the default value for the ‘path’ job attribute using the NixOS
module system so that it can be overriden. Also use an ‘apply’ to compute the actual $PATH. svn path=/nixos/trunk/; revision=32440
This commit is contained in:
parent
35734279ae
commit
84bff53ca7
@ -7,16 +7,6 @@ let
|
|||||||
upstart = pkgs.upstart;
|
upstart = pkgs.upstart;
|
||||||
|
|
||||||
|
|
||||||
# Path for Upstart jobs. Should be quite minimal.
|
|
||||||
upstartPath =
|
|
||||||
[ pkgs.coreutils
|
|
||||||
pkgs.findutils
|
|
||||||
pkgs.gnugrep
|
|
||||||
pkgs.gnused
|
|
||||||
upstart
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
# From a job description, generate an Upstart job file.
|
# From a job description, generate an Upstart job file.
|
||||||
makeJob = job:
|
makeJob = job:
|
||||||
|
|
||||||
@ -41,7 +31,7 @@ let
|
|||||||
|
|
||||||
${optionalString (job.stopOn != "") "stop on ${job.stopOn}"}
|
${optionalString (job.stopOn != "") "stop on ${job.stopOn}"}
|
||||||
|
|
||||||
env PATH=${makeSearchPath "bin" (job.path ++ upstartPath)}:${makeSearchPath "sbin" (job.path ++ upstartPath)}
|
env PATH=${job.path}
|
||||||
|
|
||||||
${concatMapStrings (n: "env ${n}=\"${getAttr n env}\"\n") (attrNames env)}
|
${concatMapStrings (n: "env ${n}=\"${getAttr n env}\"\n") (attrNames env)}
|
||||||
|
|
||||||
@ -276,6 +266,7 @@ let
|
|||||||
|
|
||||||
path = mkOption {
|
path = mkOption {
|
||||||
default = [ ];
|
default = [ ];
|
||||||
|
apply = ps: "${makeSearchPath "bin" ps}:${makeSearchPath "sbin" ps}";
|
||||||
description = ''
|
description = ''
|
||||||
Packages added to the job's <envar>PATH</envar> environment variable.
|
Packages added to the job's <envar>PATH</envar> environment variable.
|
||||||
Both the <filename>bin</filename> and <filename>sbin</filename>
|
Both the <filename>bin</filename> and <filename>sbin</filename>
|
||||||
@ -289,6 +280,7 @@ let
|
|||||||
upstartJob = {name, config, ...}: {
|
upstartJob = {name, config, ...}: {
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
jobDrv = mkOption {
|
jobDrv = mkOption {
|
||||||
default = makeJob config;
|
default = makeJob config;
|
||||||
type = types.uniq types.package;
|
type = types.uniq types.package;
|
||||||
@ -297,13 +289,25 @@ let
|
|||||||
value is generated from other options.
|
value is generated from other options.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
||||||
# The default name is the name extracted from the attribute path.
|
# The default name is the name extracted from the attribute path.
|
||||||
name = mkDefaultValue (
|
name = mkDefaultValue (
|
||||||
replaceChars ["<" ">" "*"] ["_" "_" "_name_"] name
|
replaceChars ["<" ">" "*"] ["_" "_" "_name_"] name
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Default path for Upstart jobs. Should be quite minimal.
|
||||||
|
path =
|
||||||
|
[ pkgs.coreutils
|
||||||
|
pkgs.findutils
|
||||||
|
pkgs.gnugrep
|
||||||
|
pkgs.gnused
|
||||||
|
upstart
|
||||||
|
];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user