diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index c05b6a05f4d8..66570cba946e 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -53,35 +53,6 @@ rec { }); }; - - # Return a modified stdenv that adds a cross compiler to the - # builds. - makeStdenvCross = { stdenv - , cc - , buildPlatform, hostPlatform, targetPlatform - , # Prior overrides are surely not valid as packages built - # with this run on a different platform, so disable by - # default. - overrides ? _: _: {} - } @ overrideArgs: - overrideArgs.stdenv.override (old: { - inherit - buildPlatform hostPlatform targetPlatform - cc overrides; - - allowedRequisites = null; - extraNativeBuildInputs = old.extraNativeBuildInputs - # without proper `file` command, libtool sometimes fails - # to recognize 64-bit DLLs - ++ stdenv.lib.optional (hostPlatform.config == "x86_64-w64-mingw32") pkgs.file - ++ stdenv.lib.optional - (hostPlatform.isAarch64 || hostPlatform.isMips || hostPlatform.libc == "musl") - pkgs.updateAutotoolsGnuConfigScriptsHook - ; - - extraBuildInputs = [ ]; # Old ones run on wrong platform - }); - /* Modify a stdenv so that the specified attributes are added to every derivation returned by its mkDerivation function. diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index ab42dd319a62..29521874d1eb 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -34,17 +34,31 @@ in lib.init bootStages ++ [ (buildPackages: { inherit config overlays; selfBuild = false; - stdenv = buildPackages.makeStdenvCross { - inherit (buildPackages) stdenv; + stdenv = buildPackages.stdenv.override (old: rec { buildPlatform = localSystem; hostPlatform = crossSystem; targetPlatform = crossSystem; + + # Prior overrides are surely not valid as packages built with this run on + # a different platform, and so are disabled. + overrides = _: _: {}; + extraBuildInputs = [ ]; # Old ones run on wrong platform + cc = if crossSystem.useiOSPrebuilt or false then buildPackages.darwin.iosSdkPkgs.clang else if crossSystem.useAndroidPrebuilt then buildPackages.androidenv."androidndkPkgs_${crossSystem.ndkVer}".gcc else buildPackages.gcc; - }; + + extraNativeBuildInputs = old.extraNativeBuildInputs + # without proper `file` command, libtool sometimes fails + # to recognize 64-bit DLLs + ++ lib.optional (hostPlatform.config == "x86_64-w64-mingw32") buildPackages.file + ++ lib.optional + (hostPlatform.isAarch64 || hostPlatform.isMips || hostPlatform.libc == "musl") + buildPackages.updateAutotoolsGnuConfigScriptsHook + ; + }); }) ]