summary refs log tree commit diff
path: root/pkgs/stdenv/adapters.nix
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@Yahoo.com>2017-01-15 16:47:53 -0500
committerJohn Ericson <Ericson2314@Yahoo.com>2017-01-24 11:37:56 -0500
commit1c0365bd88b7d98377ff639b5ede5f725e05663b (patch)
tree5f107a470a623e747dc7f3e3b5bc1f6cc903c4c7 /pkgs/stdenv/adapters.nix
parent09401d44eb402a368b1eb6908a68e5b5a3e64e05 (diff)
downloadnixpkgs-1c0365bd88b7d98377ff639b5ede5f725e05663b.tar
nixpkgs-1c0365bd88b7d98377ff639b5ede5f725e05663b.tar.gz
nixpkgs-1c0365bd88b7d98377ff639b5ede5f725e05663b.tar.bz2
nixpkgs-1c0365bd88b7d98377ff639b5ede5f725e05663b.tar.lz
nixpkgs-1c0365bd88b7d98377ff639b5ede5f725e05663b.tar.xz
nixpkgs-1c0365bd88b7d98377ff639b5ede5f725e05663b.tar.zst
nixpkgs-1c0365bd88b7d98377ff639b5ede5f725e05663b.zip
cross-stdenv: Inline useless bindings and reindent
Semantics should be unchanged
Diffstat (limited to 'pkgs/stdenv/adapters.nix')
-rw-r--r--pkgs/stdenv/adapters.nix108
1 files changed, 53 insertions, 55 deletions
diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix
index 5d66db266c7..7e0eaeddd2c 100644
--- a/pkgs/stdenv/adapters.nix
+++ b/pkgs/stdenv/adapters.nix
@@ -56,61 +56,59 @@ rec {
 
   # Return a modified stdenv that adds a cross compiler to the
   # builds.
-  makeStdenvCross = stdenv: cross: binutilsCross: gccCross: stdenv //
-    { mkDerivation = {name ? "", buildInputs ? [], nativeBuildInputs ? [],
-            propagatedBuildInputs ? [], propagatedNativeBuildInputs ? [],
-            selfNativeBuildInput ? false, ...}@args: let
-
-            # *BuildInputs exists temporarily as another name for
-            # *HostInputs.
-
-            # In nixpkgs, sometimes 'null' gets in as a buildInputs element,
-            # and we handle that through isAttrs.
-            nativeBuildInputsDrvs = nativeBuildInputs;
-            buildInputsDrvs = buildInputs;
-            propagatedBuildInputsDrvs = propagatedBuildInputs;
-            propagatedNativeBuildInputsDrvs = propagatedNativeBuildInputs;
-
-            # The base stdenv already knows that nativeBuildInputs and
-            # buildInputs should be built with the usual gcc-wrapper
-            # And the same for propagatedBuildInputs.
-            nativeDrv = stdenv.mkDerivation args;
-
-            # Temporary expression until the cross_renaming, to handle the
-            # case of pkgconfig given as buildInput, but to be used as
-            # nativeBuildInput.
-            hostAsNativeDrv = drv:
-                builtins.unsafeDiscardStringContext drv.nativeDrv.drvPath
-                == builtins.unsafeDiscardStringContext drv.crossDrv.drvPath;
-            buildInputsNotNull = stdenv.lib.filter
-                (drv: builtins.isAttrs drv && drv ? nativeDrv) buildInputs;
-            nativeInputsFromBuildInputs = stdenv.lib.filter hostAsNativeDrv buildInputsNotNull;
-
-        in      stdenv.mkDerivation (args // {
-                    name = name + "-" + cross.config;
-                    nativeBuildInputs = nativeBuildInputsDrvs
-                      ++ nativeInputsFromBuildInputs
-                      ++ [ gccCross binutilsCross ]
-                      ++ stdenv.lib.optional selfNativeBuildInput nativeDrv
-                        # without proper `file` command, libtool sometimes fails
-                        # to recognize 64-bit DLLs
-                      ++ stdenv.lib.optional (cross.config  == "x86_64-w64-mingw32") pkgs.file
-                      ;
-
-                    # Cross-linking dynamic libraries, every buildInput should
-                    # be propagated because ld needs the -rpath-link to find
-                    # any library needed to link the program dynamically at
-                    # loader time. ld(1) explains it.
-                    buildInputs = [];
-                    propagatedBuildInputs = propagatedBuildInputsDrvs ++ buildInputsDrvs;
-                    propagatedNativeBuildInputs = propagatedNativeBuildInputsDrvs;
-
-                    crossConfig = cross.config;
-                } // args.crossAttrs or {});
-    } // {
-      inherit gccCross binutilsCross;
-      ccCross = gccCross;
-    };
+  makeStdenvCross = stdenv: cross: binutilsCross: gccCross: stdenv // {
+
+    mkDerivation =
+      { name ? "", buildInputs ? [], nativeBuildInputs ? []
+      , propagatedBuildInputs ? [], propagatedNativeBuildInputs ? []
+      , selfNativeBuildInput ? false, ...
+      } @ args:
+
+      let
+        # *BuildInputs exists temporarily as another name for
+        # *HostInputs.
+
+        # The base stdenv already knows that nativeBuildInputs and
+        # buildInputs should be built with the usual gcc-wrapper
+        # And the same for propagatedBuildInputs.
+        nativeDrv = stdenv.mkDerivation args;
+
+        # Temporary expression until the cross_renaming, to handle the
+        # case of pkgconfig given as buildInput, but to be used as
+        # nativeBuildInput.
+        hostAsNativeDrv = drv:
+            builtins.unsafeDiscardStringContext drv.nativeDrv.drvPath
+            == builtins.unsafeDiscardStringContext drv.crossDrv.drvPath;
+        buildInputsNotNull = stdenv.lib.filter
+            (drv: builtins.isAttrs drv && drv ? nativeDrv) buildInputs;
+        nativeInputsFromBuildInputs = stdenv.lib.filter hostAsNativeDrv buildInputsNotNull;
+      in
+        stdenv.mkDerivation (args // {
+          name = name + "-" + cross.config;
+          nativeBuildInputs = nativeBuildInputs
+            ++ nativeInputsFromBuildInputs
+            ++ [ gccCross binutilsCross ]
+            ++ stdenv.lib.optional selfNativeBuildInput nativeDrv
+              # without proper `file` command, libtool sometimes fails
+              # to recognize 64-bit DLLs
+            ++ stdenv.lib.optional (cross.config  == "x86_64-w64-mingw32") pkgs.file
+            ;
+
+          # Cross-linking dynamic libraries, every buildInput should
+          # be propagated because ld needs the -rpath-link to find
+          # any library needed to link the program dynamically at
+          # loader time. ld(1) explains it.
+          buildInputs = [];
+          propagatedBuildInputs = propagatedBuildInputs ++ buildInputs;
+          propagatedNativeBuildInputs = propagatedNativeBuildInputs;
+
+          crossConfig = cross.config;
+        } // args.crossAttrs or {});
+
+    inherit gccCross binutilsCross;
+    ccCross = gccCross;
+
+  };
 
 
   /* Modify a stdenv so that the specified attributes are added to