From c2f7256101f5091be42bf7998953efcab948bfbc Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 9 Jan 2011 22:00:41 +0000 Subject: [PATCH] * Added an option `system.upstartEnvironment' to add a variable to all Upstart jobs. svn path=/nixos/trunk/; revision=25478 --- modules/system/upstart/upstart.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/system/upstart/upstart.nix b/modules/system/upstart/upstart.nix index 535e612ed32c..7373bed5390d 100644 --- a/modules/system/upstart/upstart.nix +++ b/modules/system/upstart/upstart.nix @@ -1,4 +1,4 @@ -{config, pkgs, ...}: +{ config, pkgs, ... }: with pkgs.lib; @@ -23,6 +23,8 @@ let let hasMain = job.script != "" || job.exec != ""; + env = config.system.upstartEnvironment // job.environment; + jobText = 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)} - ${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 != "") '' pre-start script @@ -334,6 +336,15 @@ in ''; }; + system.upstartEnvironment = mkOption { + type = types.attrs; + default = {}; + example = { TZ = "CET"; }; + description = '' + Environment variables passed to all Upstart jobs. + ''; + }; + };