···11let lib = import ../../../lib; in lib.makeOverridable (
2233-{ system, name ? "stdenv", preHook ? "", initialPath, cc, shell
33+{ name ? "stdenv", preHook ? "", initialPath, cc, shell
44, allowedRequisites ? null, extraAttrs ? {}, overrides ? (self: super: {}), config
5566, # The `fetchurl' to use for downloading curl and its dependencies
···1414, __extraImpureHostDeps ? []
1515, stdenvSandboxProfile ? ""
1616, extraSandboxProfile ? ""
1717+1818+, # The platforms here do *not* correspond to the stage the stdenv is
1919+ # used in, but rather the previous one, in which it was built. We
2020+ # use the latter two platforms, like a cross compiler, because the
2121+ # stand environment is a build tool if you squint at it, and because
2222+ # neither of these are used when building stdenv so we know the
2323+ # build platform is irrelevant.
2424+ hostPlatform, targetPlatform
1725}:
18261927let
2828+ inherit (targetPlatform) system;
20292130 # See discussion at https://github.com/NixOS/nixpkgs/pull/25304#issuecomment-298385426
2231 # for why this defaults to false, but I (@copumpkin) want to default it to true soon.
···265274266275 outputs' =
267276 outputs ++
268268- (if separateDebugInfo then assert result.isLinux; [ "debug" ] else []);
277277+ (if separateDebugInfo then assert targetPlatform.isLinux; [ "debug" ] else []);
269278270279 buildInputs' = lib.chooseDevOutputs buildInputs ++
271280 (if separateDebugInfo then [ ../../build-support/setup-hooks/separate-debug-info.sh ] else []);
···311320 # Inputs built by the usual native compiler.
312321 nativeBuildInputs = nativeBuildInputs'
313322 ++ lib.optional
314314- (result.isCygwin
323323+ (hostPlatform.isCygwin
315324 || (crossConfig != null && lib.hasSuffix "mingw32" crossConfig))
316325 ../../build-support/setup-hooks/win-dll-link.sh
317326 ;
···392401 };
393402394403 # Utility flags to test the type of platform.
395395- isDarwin = system == "x86_64-darwin";
396396- isLinux = system == "i686-linux"
397397- || system == "x86_64-linux"
398398- || system == "powerpc-linux"
399399- || system == "armv5tel-linux"
400400- || system == "armv6l-linux"
401401- || system == "armv7l-linux"
402402- || system == "aarch64-linux"
403403- || system == "mips64el-linux";
404404- isGNU = system == "i686-gnu"; # GNU/Hurd
405405- isSunOS = system == "i686-solaris"
406406- || system == "x86_64-solaris";
407407- isCygwin = system == "i686-cygwin"
408408- || system == "x86_64-cygwin";
409409- isFreeBSD = system == "i686-freebsd"
410410- || system == "x86_64-freebsd";
411411- isOpenBSD = system == "i686-openbsd"
412412- || system == "x86_64-openbsd";
413413- isi686 = system == "i686-linux"
414414- || system == "i686-gnu"
415415- || system == "i686-freebsd"
416416- || system == "i686-openbsd"
417417- || system == "i686-cygwin"
418418- || system == "i386-sunos";
419419- isx86_64 = system == "x86_64-linux"
420420- || system == "x86_64-darwin"
421421- || system == "x86_64-freebsd"
422422- || system == "x86_64-openbsd"
423423- || system == "x86_64-cygwin"
424424- || system == "x86_64-solaris";
425425- is64bit = system == "x86_64-linux"
426426- || system == "x86_64-darwin"
427427- || system == "x86_64-freebsd"
428428- || system == "x86_64-openbsd"
429429- || system == "x86_64-cygwin"
430430- || system == "x86_64-solaris"
431431- || system == "aarch64-linux"
432432- || system == "mips64el-linux";
433433- isMips = system == "mips-linux"
434434- || system == "mips64el-linux";
435435- isArm = system == "armv5tel-linux"
436436- || system == "armv6l-linux"
437437- || system == "armv7l-linux";
438438- isAarch64 = system == "aarch64-linux";
439439- isBigEndian = system == "powerpc-linux";
404404+ inherit (hostPlatform)
405405+ isDarwin isLinux isSunOS isCygwin isFreeBSD isOpenBSD isi686 isx86_64
406406+ is64bit isMips isBigEndian;
407407+ isArm = hostPlatform.isArm32;
408408+ isAarch64 = hostPlatform.isArm64;
409409+ # Other code instead checks for anything using GNU userland,
410410+ # e.g. GNU/linux. This refers just to GNU Hurd.
411411+ isGNU = system == "i686-gnu";
440412441413 # Whether we should run paxctl to pax-mark binaries.
442414 needsPax = isLinux;