From 84bff53ca7604bd1775d99b24cfe61227daf1021 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 20 Feb 2012 19:23:15 +0000 Subject: [PATCH] =?UTF-8?q?*=20Set=20the=20default=20value=20for=20the=20?= =?UTF-8?q?=E2=80=98path=E2=80=99=20job=20attribute=20using=20the=20NixOS?= =?UTF-8?q?=20=20=20module=20system=20so=20that=20it=20can=20be=20override?= =?UTF-8?q?n.=20=20Also=20use=20an=20=E2=80=98apply=E2=80=99=20to=20=20=20?= =?UTF-8?q?compute=20the=20actual=20$PATH.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/nixos/trunk/; revision=32440 --- modules/system/upstart/upstart.nix | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/modules/system/upstart/upstart.nix b/modules/system/upstart/upstart.nix index 09e81983e81f..d3edf2a459af 100644 --- a/modules/system/upstart/upstart.nix +++ b/modules/system/upstart/upstart.nix @@ -7,16 +7,6 @@ let 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. makeJob = job: @@ -41,7 +31,7 @@ let ${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)} @@ -276,6 +266,7 @@ let path = mkOption { default = [ ]; + apply = ps: "${makeSearchPath "bin" ps}:${makeSearchPath "sbin" ps}"; description = '' Packages added to the job's PATH environment variable. Both the bin and sbin @@ -289,6 +280,7 @@ let upstartJob = {name, config, ...}: { options = { + jobDrv = mkOption { default = makeJob config; type = types.uniq types.package; @@ -297,13 +289,25 @@ let value is generated from other options. ''; }; + }; config = { + # The default name is the name extracted from the attribute path. name = mkDefaultValue ( replaceChars ["<" ">" "*"] ["_" "_" "_name_"] name ); + + # Default path for Upstart jobs. Should be quite minimal. + path = + [ pkgs.coreutils + pkgs.findutils + pkgs.gnugrep + pkgs.gnused + upstart + ]; + }; };