summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-03-06 16:42:06 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-03-27 16:17:48 +0100
commit8b2f209838668ead093dec603bdfdb0347a69a07 (patch)
tree12a577516e768a91f3f8c646d481f6fc68d0e5d7 /pkgs/stdenv
parent0e2257966f030799334a8df5cdf94977c3513c28 (diff)
downloadnixlib-8b2f209838668ead093dec603bdfdb0347a69a07.tar
nixlib-8b2f209838668ead093dec603bdfdb0347a69a07.tar.gz
nixlib-8b2f209838668ead093dec603bdfdb0347a69a07.tar.bz2
nixlib-8b2f209838668ead093dec603bdfdb0347a69a07.tar.lz
nixlib-8b2f209838668ead093dec603bdfdb0347a69a07.tar.xz
nixlib-8b2f209838668ead093dec603bdfdb0347a69a07.tar.zst
nixlib-8b2f209838668ead093dec603bdfdb0347a69a07.zip
mkDerivation: Use function arguments
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/default.nix28
1 files changed, 15 insertions, 13 deletions
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index 751366e38d23..a53ccc3b60a4 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -83,7 +83,15 @@ let
 
   # Add a utility function to produce derivations that use this
   # stdenv and its shell.
-  mkDerivation = attrs:
+  mkDerivation =
+    { buildInputs ? []
+    , nativeBuildInputs ? []
+    , propagatedBuildInputs ? []
+    , propagatedNativeBuildInputs ? []
+    , crossConfig ? null
+    , meta ? {}
+    , passthru ? {}
+    , ... } @ attrs:
     let
       pos =
         if attrs.meta.description or null != null then
@@ -122,13 +130,7 @@ let
 
       lib.addPassthru (derivation (
         (removeAttrs attrs ["meta" "passthru" "crossAttrs"])
-        // (let
-          buildInputs = attrs.buildInputs or [];
-          nativeBuildInputs = attrs.nativeBuildInputs or [];
-          propagatedBuildInputs = attrs.propagatedBuildInputs or [];
-          propagatedNativeBuildInputs = attrs.propagatedNativeBuildInputs or [];
-          crossConfig = attrs.crossConfig or null;
-        in
+        //
         {
           builder = attrs.realBuilder or shell;
           args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
@@ -144,7 +146,7 @@ let
           nativeBuildInputs = nativeBuildInputs ++ (if crossConfig == null then buildInputs else []);
           propagatedNativeBuildInputs = propagatedNativeBuildInputs ++
             (if crossConfig == null then propagatedBuildInputs else []);
-        }))) (
+        })) (
       {
         # The meta attribute is passed in the resulting attribute set,
         # but it's not part of the actual derivation, i.e., it's not
@@ -152,15 +154,15 @@ let
         # include it in the result, it *is* available to nix-env for
         # queries.  We also a meta.position attribute here to
         # identify the source location of the package.
-        meta = attrs.meta or {} // (if pos != null then {
-          position = pos.file + ":" + (toString pos.line);
+        meta = meta // (if pos != null then {
+          position = pos.file + ":" + toString pos.line;
         } else {});
-        passthru = attrs.passthru or {};
+        inherit passthru;
       } //
       # Pass through extra attributes that are not inputs, but
       # should be made available to Nix expressions using the
       # derivation (e.g., in assertions).
-      (attrs.passthru or {}));
+      passthru);
 
   # The stdenv that we are producing.
   result =