11 bootStages = import ../. {
12 inherit lib localSystem overlays;
14 crossSystem = localSystem;
17 # Ignore custom stdenvs when cross compiling for compatibility
18 # Use replaceCrossStdenv instead.
19 config = builtins.removeAttrs config [ "replaceStdenv" ];
26 # Regular native packages
29 lib.last bootStages somePrevStage
31 # It's OK to change the built-time dependencies
32 allowCustomOverrides = true;
38 inherit config overlays;
41 assert vanillaPackages.stdenv.buildPlatform == localSystem;
42 assert vanillaPackages.stdenv.hostPlatform == localSystem;
43 assert vanillaPackages.stdenv.targetPlatform == localSystem;
44 vanillaPackages.stdenv.override { targetPlatform = crossSystem; };
45 # It's OK to change the built-time dependencies
46 allowCustomOverrides = true;
53 adaptStdenv = if crossSystem.isStatic then buildPackages.stdenvAdapters.makeStatic else lib.id;
54 stdenvNoCC = adaptStdenv (
55 buildPackages.stdenv.override (old: rec {
56 buildPlatform = localSystem;
57 hostPlatform = crossSystem;
58 targetPlatform = crossSystem;
60 # Prior overrides are surely not valid as packages built with this run on
61 # a different platform, and so are disabled.
62 overrides = _: _: { };
63 extraBuildInputs = [ ]; # Old ones run on wrong platform
64 allowedRequisites = null;
69 extraNativeBuildInputs =
70 old.extraNativeBuildInputs
71 ++ lib.optionals (hostPlatform.isLinux && !buildPlatform.isLinux) [ buildPackages.patchelf ]
77 || builtins.elem p.libc [
85 f hostPlatform && !(f buildPlatform)
86 ) buildPackages.updateAutotoolsGnuConfigScriptsHook;
92 overlays = overlays ++ crossOverlays;
97 inherit (stdenvNoCC) hostPlatform targetPlatform;
98 baseStdenv = stdenvNoCC.override {
99 # Old ones run on wrong platform
100 extraBuildInputs = lib.optionals hostPlatform.isDarwin [
101 buildPackages.targetPackages.apple-sdk
104 hasCC = !stdenvNoCC.targetPlatform.isGhcjs;
107 if crossSystem.useiOSPrebuilt or false then
108 buildPackages.darwin.iosSdkPkgs.clang
109 else if crossSystem.useAndroidPrebuilt or false then
110 buildPackages."androidndkPkgs_${crossSystem.androidNdkVersion}".clang
112 targetPlatform.isGhcjs
113 # Need to use `throw` so tryEval for splicing works, ugh. Using
114 # `null` or skipping the attribute would cause an eval failure
115 # `tryEval` wouldn't catch, wrecking accessing previous stages
116 # when there is a C compiler and everything should be fine.
118 throw "no C compiler provided for this platform"
119 else if crossSystem.isDarwin then
120 buildPackages.llvmPackages.libcxxClang
121 else if crossSystem.useLLVM or false then
122 buildPackages.llvmPackages.clang
123 else if crossSystem.useZig or false then
125 else if crossSystem.useArocc or false then
132 if config ? replaceCrossStdenv then
133 config.replaceCrossStdenv { inherit buildPackages baseStdenv; }