* Added an option `system.upstartEnvironment' to add a variable to all
Upstart jobs. svn path=/nixos/trunk/; revision=25478
This commit is contained in:
parent
20b8258e68
commit
c2f7256101
|
@ -1,4 +1,4 @@
|
||||||
{config, pkgs, ...}:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
with pkgs.lib;
|
with pkgs.lib;
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@ let
|
||||||
let
|
let
|
||||||
hasMain = job.script != "" || job.exec != "";
|
hasMain = job.script != "" || job.exec != "";
|
||||||
|
|
||||||
|
env = config.system.upstartEnvironment // job.environment;
|
||||||
|
|
||||||
jobText =
|
jobText =
|
||||||
let log = "/var/log/upstart/${job.name}"; in
|
let log = "/var/log/upstart/${job.name}"; in
|
||||||
''
|
''
|
||||||
|
@ -41,7 +43,7 @@ let
|
||||||
|
|
||||||
env PATH=${makeSearchPath "bin" (job.path ++ upstartPath)}:${makeSearchPath "sbin" (job.path ++ upstartPath)}
|
env PATH=${makeSearchPath "bin" (job.path ++ upstartPath)}:${makeSearchPath "sbin" (job.path ++ upstartPath)}
|
||||||
|
|
||||||
${concatMapStrings (n: "env ${n}=\"${getAttr n job.environment}\"\n") (attrNames job.environment)}
|
${concatMapStrings (n: "env ${n}=\"${getAttr n env}\"\n") (attrNames env)}
|
||||||
|
|
||||||
${optionalString (job.preStart != "") ''
|
${optionalString (job.preStart != "") ''
|
||||||
pre-start script
|
pre-start script
|
||||||
|
@ -334,6 +336,15 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
system.upstartEnvironment = mkOption {
|
||||||
|
type = types.attrs;
|
||||||
|
default = {};
|
||||||
|
example = { TZ = "CET"; };
|
||||||
|
description = ''
|
||||||
|
Environment variables passed to <emphasis>all</emphasis> Upstart jobs.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue