about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2019-08-17 09:39:23 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2019-08-17 09:39:23 +0200
commitfe9a3e3e63fa59c8014d454b0efd3231bdd19350 (patch)
tree3546e83902366b34599e8d5f6a698e37935a104d /pkgs/build-support
parented3cb39bfa7234e5bbf2b50ce6f658ef5fda686a (diff)
parentc68f58d95c0e34d91ff3e4f08464954fd0e9e466 (diff)
Merge staging-next into staging
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/docker/default.nix7
-rw-r--r--pkgs/build-support/rust/default.nix22
2 files changed, 19 insertions, 10 deletions
diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix
index ae3d93ff3db39..83e21c8945dc5 100644
--- a/pkgs/build-support/docker/default.nix
+++ b/pkgs/build-support/docker/default.nix
@@ -291,9 +291,10 @@ rec {
     # Files to add to the layer.
     closure,
     configJson,
-    # Docker has a 42-layer maximum, we pick 24 to ensure there is plenty
-    # of room for extension
-    maxLayers ? 24
+    # Docker has a 125-layer maximum, we pick 100 to ensure there is
+    # plenty of room for extension.
+    # https://github.com/moby/moby/blob/b3e9f7b13b0f0c414fa6253e1f17a86b2cff68b5/layer/layer_store.go#L23-L26
+    maxLayers ? 100
   }:
     let
       storePathToLayer = substituteAll
diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix
index bd18f108e4eb9..09802d56d34c5 100644
--- a/pkgs/build-support/rust/default.nix
+++ b/pkgs/build-support/rust/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cacert, git, cargo, rustc, fetchcargo, buildPackages }:
+{ stdenv, cacert, git, cargo, rustc, fetchcargo, buildPackages, windows }:
 
 { name ? "${args.pname}-${args.version}"
 , cargoSha256 ? "unset"
@@ -41,18 +41,26 @@ let
       cargoDepsCopy="$sourceRoot/${cargoVendorDir}"
     '';
 
+  hostConfig = stdenv.hostPlatform.config;
+
+  rustHostConfig = {
+    "x86_64-pc-mingw32" = "x86_64-pc-windows-gnu";
+  }."${hostConfig}" or hostConfig;
+
   ccForBuild="${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc";
   cxxForBuild="${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++";
   ccForHost="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
   cxxForHost="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
-  releaseDir = "target/${stdenv.hostPlatform.config}/${buildType}";
-in stdenv.mkDerivation (args // {
+  releaseDir = "target/${rustHostConfig}/${buildType}";
+in
+
+stdenv.mkDerivation (args // {
   inherit cargoDeps;
 
   patchRegistryDeps = ./patch-registry-deps;
 
-  nativeBuildInputs = [ cargo rustc git cacert ] ++ nativeBuildInputs;
-  inherit buildInputs;
+  nativeBuildInputs = nativeBuildInputs ++ [ cacert git cargo rustc ];
+  buildInputs = buildInputs ++ stdenv.lib.optional stdenv.hostPlatform.isMinGW windows.pthreads;
 
   patches = cargoPatches ++ patches;
 
@@ -76,7 +84,7 @@ in stdenv.mkDerivation (args // {
     [target."${stdenv.buildPlatform.config}"]
     "linker" = "${ccForBuild}"
     ${stdenv.lib.optionalString (stdenv.buildPlatform.config != stdenv.hostPlatform.config) ''
-    [target."${stdenv.hostPlatform.config}"]
+    [target."${rustHostConfig}"]
     "linker" = "${ccForHost}"
     ''}
     EOF
@@ -102,7 +110,7 @@ in stdenv.mkDerivation (args // {
       "CXX_${stdenv.hostPlatform.config}"="${cxxForHost}" \
       cargo build \
         ${stdenv.lib.optionalString (buildType == "release") "--release"} \
-        --target ${stdenv.hostPlatform.config} \
+        --target ${rustHostConfig} \
         --frozen ${concatStringsSep " " cargoBuildFlags}
     )