[Nix-dev] [PATCH] t/num_cores

Marc Weber marco-oweber at gmx.de
Mon Jun 14 00:02:16 CEST 2010


example how to pass options to nix-daemon

Signed-off-by: Marc Weber <marco-oweber at gmx.de>
---
 modules/services/mail/postfix.nix    |   16 ++++++++++------
 modules/services/misc/nix-daemon.nix |    4 ++++
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/modules/services/mail/postfix.nix b/modules/services/mail/postfix.nix
index 9392606..815ba3c 100644
--- a/modules/services/mail/postfix.nix
+++ b/modules/services/mail/postfix.nix
@@ -275,7 +275,7 @@ in
         }
       ];
 
-    jobs.postfix =
+    jobs.postfix6 =
       # I copy _lots_ of shipped configuration filed 
       # that can be left as is. I am afraid the exact
       # will list slightly change in next Postfix 
@@ -287,10 +287,11 @@ in
 
         daemonType = "none";
 
-        respawn = false;
+        respawn = true;
 
-        preStart =
+        preStart = 
           ''
+            set -x
             if ! [ -d /var/spool/postfix ]; then
               ${pkgs.coreutils}/bin/mkdir -p /var/spool/mail /var/postfix/conf /var/postfix/queue
             fi
@@ -308,11 +309,14 @@ in
 
             ${pkgs.postfix}/sbin/postalias -c /var/postfix/conf /var/postfix/conf/aliases
             
-            exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf start
-          ''; # */
+            echo prestart done
+          '';
+          #exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf start
+
+        exec = "sleep 30";
 
         preStop = ''
-            exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf stop
+           exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf stop || true
         '';
 
       };
diff --git a/modules/services/misc/nix-daemon.nix b/modules/services/misc/nix-daemon.nix
index a9a0bc7..fcdcc8f 100644
--- a/modules/services/misc/nix-daemon.nix
+++ b/modules/services/misc/nix-daemon.nix
@@ -162,6 +162,10 @@ in
         internal = true;
         default = "";
         merge = mergeStringOption;
+        example = ''
+          export NIX_TARGET_LOAD=$(( 3 * $(${pkgs.coreutils}/bin/nproc) / 2 ))
+          export NIX_MAX_PARALLELIZATION=$NIX_TARGET_LOAD
+        '';
         description = "
           Environment variables used by Nix.
         ";
-- 
1.7.1




More information about the nix-dev mailing list