summary refs log tree commit diff
path: root/pkgs/stdenv/generic/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/stdenv/generic/default.nix')
-rw-r--r--pkgs/stdenv/generic/default.nix34
1 files changed, 25 insertions, 9 deletions
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index 9c877252e2be6..d7b953ffb0562 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -1,17 +1,33 @@
-{ stdenv, name, preHook ? null, postHook ? null, initialPath, gcc
+{ stdenv, name, preHook ? null, postHook ? null, initialPath, gcc, bash
 , param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? ""
 }:
 
-derivation {
-  inherit stdenv name;
-  system = stdenv.system;
+let {
 
-  builder = ./builder.sh;
+  body =
 
-  setup = ./setup.sh;
+    stdenv.mkDerivation {
+      inherit name;
 
-  inherit preHook postHook initialPath gcc;
+      builder = ./builder.sh;
+
+      setup = ./setup.sh;
+
+      inherit preHook postHook initialPath gcc;
+
+      # TODO: make this more elegant.
+      inherit param1 param2 param3 param4 param5;
+    }
+
+    # Add a utility function to produce derivations that use this
+    # stdenv and its the bash shell.
+    // {
+      mkDerivation = attrs: derivation (attrs // {
+        builder = bash;
+        args = ["-e" (if attrs ? builder then attrs.builder else ./default-builder.sh)];
+        stdenv = body;
+        system = body.system;
+      });
+    };
 
-  # TODO: make this more elegant.
-  inherit param1 param2 param3 param4 param5;
 }