Author: eelco
Date: Mon Feb 20 19:23:15 2012
New Revision: 32440
URL: https://nixos.org/websvn/nix/?rev=32440&sc=1

Log:
* 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.

Modified:
   nixos/trunk/modules/system/upstart/upstart.nix

Modified: nixos/trunk/modules/system/upstart/upstart.nix
==============================================================================
--- nixos/trunk/modules/system/upstart/upstart.nix      Mon Feb 20 19:09:38 
2012        (r32439)
+++ nixos/trunk/modules/system/upstart/upstart.nix      Mon Feb 20 19:23:15 
2012        (r32440)
@@ -7,16 +7,6 @@
   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 @@
 
           ${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 @@
 
     path = mkOption {
       default = [ ];
+      apply = ps: "${makeSearchPath "bin" ps}:${makeSearchPath "sbin" ps}";
       description = ''
         Packages added to the job's <envar>PATH</envar> environment variable.
         Both the <filename>bin</filename> and <filename>sbin</filename>
@@ -289,6 +280,7 @@
   upstartJob = {name, config, ...}: {
 
     options = {
+    
       jobDrv = mkOption {
         default = makeJob config;
         type = types.uniq types.package;
@@ -297,13 +289,25 @@
           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
+        ];
+      
     };
 
   };
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to