top-level: {build,host,target}Platform are defined in the stdenv instead

See #27069 for a discussion of this
This commit is contained in:
John Ericson 2017-07-05 21:47:48 -04:00
parent afc2023993
commit a302d7360f
12 changed files with 90 additions and 124 deletions

View file

@ -10,7 +10,6 @@
, zlib ? null, extraPackages ? [], extraBuildCommands ? "" , zlib ? null, extraPackages ? [], extraBuildCommands ? ""
, dyld ? null # TODO: should this be a setup-hook on dyld? , dyld ? null # TODO: should this be a setup-hook on dyld?
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null , isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
, hostPlatform, targetPlatform
, runCommand ? null , runCommand ? null
}: }:
@ -22,12 +21,14 @@ assert !nativeTools ->
assert !(nativeLibc && noLibc); assert !(nativeLibc && noLibc);
assert (noLibc || nativeLibc) == (libc == null); assert (noLibc || nativeLibc) == (libc == null);
assert targetPlatform != hostPlatform -> runCommand != null; assert stdenv.targetPlatform != stdenv.hostPlatform -> runCommand != null;
# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper. # For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper.
assert cc.langVhdl or false -> zlib != null; assert cc.langVhdl or false -> zlib != null;
let let
inherit (stdenv) hostPlatform targetPlatform;
# Prefix for binaries. Customarily ends with a dash separator. # Prefix for binaries. Customarily ends with a dash separator.
# #
# TODO(@Ericson2314) Make unconditional, or optional but always true by # TODO(@Ericson2314) Make unconditional, or optional but always true by

View file

@ -61,11 +61,9 @@ rec {
, buildPlatform, hostPlatform, targetPlatform , buildPlatform, hostPlatform, targetPlatform
} @ overrideArgs: let } @ overrideArgs: let
stdenv = overrideArgs.stdenv.override { stdenv = overrideArgs.stdenv.override {
# TODO(@Ericson2314): Cannot do this for now because then Nix thinks the inherit
# resulting derivation should be built on the host platform. buildPlatform hostPlatform targetPlatform
#hostPlatform = buildPlatform; cc;
#targetPlatform = hostPlatform;
inherit cc;
allowedRequisites = null; allowedRequisites = null;

View file

@ -14,21 +14,18 @@ in bootStages ++ [
# Build Packages # Build Packages
(vanillaPackages: { (vanillaPackages: {
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = crossSystem;
inherit config overlays; inherit config overlays;
selfBuild = false; selfBuild = false;
stdenv =
assert vanillaPackages.hostPlatform == localSystem;
assert vanillaPackages.targetPlatform == localSystem;
vanillaPackages.stdenv.override { targetPlatform = crossSystem; };
# It's OK to change the built-time dependencies # It's OK to change the built-time dependencies
allowCustomOverrides = true; allowCustomOverrides = true;
inherit (vanillaPackages) stdenv;
}) })
# Run Packages # Run Packages
(buildPackages: { (buildPackages: {
buildPlatform = localSystem;
hostPlatform = crossSystem;
targetPlatform = crossSystem;
inherit config overlays; inherit config overlays;
selfBuild = false; selfBuild = false;
stdenv = buildPackages.makeStdenvCross { stdenv = buildPackages.makeStdenvCross {

View file

@ -15,11 +15,11 @@ in bootStages ++ [
# Additional stage, built using custom stdenv # Additional stage, built using custom stdenv
(vanillaPackages: { (vanillaPackages: {
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config overlays; inherit config overlays;
stdenv = config.replaceStdenv { pkgs = vanillaPackages; }; stdenv =
assert vanillaPackages.hostPlatform == localSystem;
assert vanillaPackages.targetPlatform == localSystem;
config.replaceStdenv { pkgs = vanillaPackages; };
}) })
] ]

View file

@ -65,6 +65,10 @@ in rec {
name = "stdenv-darwin-boot-${toString step}"; name = "stdenv-darwin-boot-${toString step}";
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper { cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper {
inherit shell; inherit shell;
inherit (last) stdenv; inherit (last) stdenv;
@ -73,8 +77,6 @@ in rec {
nativeTools = true; nativeTools = true;
nativePrefix = bootstrapTools; nativePrefix = bootstrapTools;
nativeLibc = false; nativeLibc = false;
hostPlatform = localSystem;
targetPlatform = localSystem;
libc = last.pkgs.darwin.Libsystem; libc = last.pkgs.darwin.Libsystem;
isClang = true; isClang = true;
cc = { name = "clang-9.9.9"; outPath = bootstrapTools; }; cc = { name = "clang-9.9.9"; outPath = bootstrapTools; };
@ -90,9 +92,6 @@ in rec {
''; '';
initialPath = [ bootstrapTools ]; initialPath = [ bootstrapTools ];
hostPlatform = localSystem;
targetPlatform = localSystem;
fetchurlBoot = import ../../build-support/fetchurl { fetchurlBoot = import ../../build-support/fetchurl {
stdenv = stage0.stdenv; stdenv = stage0.stdenv;
curl = bootstrapTools; curl = bootstrapTools;
@ -107,9 +106,6 @@ in rec {
}; };
in { in {
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config overlays; inherit config overlays;
stdenv = thisStdenv; stdenv = thisStdenv;
}; };
@ -279,6 +275,10 @@ in rec {
name = "stdenv-darwin"; name = "stdenv-darwin";
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
preHook = commonPreHook + '' preHook = commonPreHook + ''
export PATH_LOCALE=${pkgs.darwin.locale}/share/locale export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
''; '';
@ -286,9 +286,6 @@ in rec {
stdenvSandboxProfile = binShClosure + libSystemProfile; stdenvSandboxProfile = binShClosure + libSystemProfile;
extraSandboxProfile = binShClosure + libSystemProfile; extraSandboxProfile = binShClosure + libSystemProfile;
hostPlatform = localSystem;
targetPlatform = localSystem;
initialPath = import ../common-path.nix { inherit pkgs; }; initialPath = import ../common-path.nix { inherit pkgs; };
shell = "${pkgs.bash}/bin/bash"; shell = "${pkgs.bash}/bin/bash";
@ -297,8 +294,6 @@ in rec {
inherit shell; inherit shell;
nativeTools = false; nativeTools = false;
nativeLibc = false; nativeLibc = false;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit (pkgs) coreutils binutils gnugrep; inherit (pkgs) coreutils binutils gnugrep;
inherit (pkgs.darwin) dyld; inherit (pkgs.darwin) dyld;
cc = pkgs.llvmPackages.clang-unwrapped; cc = pkgs.llvmPackages.clang-unwrapped;
@ -338,9 +333,6 @@ in rec {
stage3 stage3
stage4 stage4
(prevStage: { (prevStage: {
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config overlays; inherit config overlays;
stdenv = stdenvDarwin prevStage; stdenv = stdenvDarwin prevStage;
}) })

View file

@ -35,6 +35,9 @@ let inherit (localSystem) system; in
stdenv = import ../generic { stdenv = import ../generic {
name = "stdenv-freebsd-boot-1"; name = "stdenv-freebsd-boot-1";
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config; inherit config;
initialPath = [ "/" "/usr" ]; initialPath = [ "/" "/usr" ];
hostPlatform = localSystem; hostPlatform = localSystem;
@ -52,6 +55,9 @@ let inherit (localSystem) system; in
stdenv = import ../generic { stdenv = import ../generic {
name = "stdenv-freebsd-boot-0"; name = "stdenv-freebsd-boot-0";
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config; inherit config;
initialPath = [ prevStage.bootstrapTools ]; initialPath = [ prevStage.bootstrapTools ];
inherit (prevStage.stdenv) inherit (prevStage.stdenv)
@ -62,12 +68,12 @@ let inherit (localSystem) system; in
}) })
(prevStage: { (prevStage: {
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config overlays; inherit config overlays;
stdenv = import ../generic { stdenv = import ../generic {
name = "stdenv-freebsd-boot-3"; name = "stdenv-freebsd-boot-3";
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config; inherit config;
inherit (prevStage.stdenv) inherit (prevStage.stdenv)
@ -77,8 +83,6 @@ let inherit (localSystem) system; in
nativeTools = true; nativeTools = true;
nativePrefix = "/usr"; nativePrefix = "/usr";
nativeLibc = true; nativeLibc = true;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit (prevStage) stdenv; inherit (prevStage) stdenv;
cc = { cc = {
name = "clang-9.9.9"; name = "clang-9.9.9";

View file

@ -15,18 +15,32 @@ let lib = import ../../../lib; in lib.makeOverridable (
, stdenvSandboxProfile ? "" , stdenvSandboxProfile ? ""
, extraSandboxProfile ? "" , extraSandboxProfile ? ""
, # The platforms here do *not* correspond to the stage the stdenv is ## Platform parameters
# used in, but rather the previous one, in which it was built. We ##
# use the latter two platforms, like a cross compiler, because the ## The "build" "host" "target" terminology below comes from GNU Autotools. See
# stand environment is a build tool if you squint at it, and because ## its documentation for more information on what those words mean. Note that
# neither of these are used when building stdenv so we know the ## each should always be defined, even when not cross compiling.
# build platform is irrelevant. ##
hostPlatform, targetPlatform ## For purposes of bootstrapping, think of each stage as a "sliding window"
## over a list of platforms. Specifically, the host platform of the previous
## stage becomes the build platform of the current one, and likewise the
## target platform of the previous stage becomes the host platform of the
## current one.
##
, # The platform on which packages are built. Consists of `system`, a
# string (e.g.,`i686-linux') identifying the most import attributes of the
# build platform, and `platform` a set of other details.
buildPlatform
, # The platform on which packages run.
hostPlatform
, # The platform which build tools (especially compilers) build for in this stage,
targetPlatform
}: }:
let let
inherit (targetPlatform) system;
defaultNativeBuildInputs = extraBuildInputs ++ defaultNativeBuildInputs = extraBuildInputs ++
[ ../../build-support/setup-hooks/move-docs.sh [ ../../build-support/setup-hooks/move-docs.sh
../../build-support/setup-hooks/compress-man-pages.sh ../../build-support/setup-hooks/compress-man-pages.sh
@ -49,7 +63,11 @@ let
derivation ( derivation (
(if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) // (if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) //
{ {
inherit system name; inherit name;
# Nix itself uses the `system` field of a derivation to decide where to
# build it. This is a bit confusing for cross compilation.
inherit (buildPlatform) system;
builder = shell; builder = shell;
@ -59,7 +77,7 @@ let
inherit preHook initialPath shell defaultNativeBuildInputs; inherit preHook initialPath shell defaultNativeBuildInputs;
} }
// lib.optionalAttrs hostPlatform.isDarwin { // lib.optionalAttrs buildPlatform.isDarwin {
__sandboxProfile = stdenvSandboxProfile; __sandboxProfile = stdenvSandboxProfile;
__impureHostDeps = __stdenvImpureHostDeps; __impureHostDeps = __stdenvImpureHostDeps;
}) })
@ -71,6 +89,8 @@ let
platforms = lib.platforms.all; platforms = lib.platforms.all;
}; };
inherit buildPlatform hostPlatform targetPlatform;
inherit extraBuildInputs __extraImpureHostDeps extraSandboxProfile; inherit extraBuildInputs __extraImpureHostDeps extraSandboxProfile;
# Utility flags to test the type of platform. # Utility flags to test the type of platform.
@ -85,9 +105,6 @@ let
inherit (import ./make-derivation.nix { inherit (import ./make-derivation.nix {
inherit lib config stdenv; inherit lib config stdenv;
# TODO(@Ericson2314): Remove
inherit
hostPlatform targetPlatform;
}) mkDerivation; }) mkDerivation;
# For convenience, bring in the library functions in lib/ so # For convenience, bring in the library functions in lib/ so

View file

@ -1,8 +1,4 @@
{ lib, config, stdenv { lib, config, stdenv }:
# TODO(@Ericson2314): get off stdenv
, hostPlatform, targetPlatform
}:
rec { rec {
# `mkDerivation` wraps the builtin `derivation` function to # `mkDerivation` wraps the builtin `derivation` function to
@ -49,12 +45,12 @@ rec {
outputs' = outputs' =
outputs ++ outputs ++
(if separateDebugInfo then assert targetPlatform.isLinux; [ "debug" ] else []); (if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []);
dependencies' = let dependencies' = let
justMap = map lib.chooseDevOutputs dependencies; justMap = map lib.chooseDevOutputs dependencies;
nativeBuildInputs = lib.elemAt justMap 0 nativeBuildInputs = lib.elemAt justMap 0
++ lib.optional targetPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh; ++ lib.optional stdenv.hostPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh;
buildInputs = lib.elemAt justMap 1 buildInputs = lib.elemAt justMap 1
# TODO(@Ericson2314): Should instead also be appended to `nativeBuildInputs`. # TODO(@Ericson2314): Should instead also be appended to `nativeBuildInputs`.
++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh; ++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh;
@ -82,7 +78,7 @@ rec {
builder = attrs.realBuilder or stdenv.shell; builder = attrs.realBuilder or stdenv.shell;
args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)]; args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
inherit stdenv; inherit stdenv;
system = stdenv.system; # TODO(@Ericson2314): be correct about cross compilation inherit (stdenv) system;
userHook = config.stdenv.userHook or null; userHook = config.stdenv.userHook or null;
__ignoreNulls = true; __ignoreNulls = true;
@ -91,7 +87,7 @@ rec {
propagatedNativeBuildInputs = lib.elemAt propagatedDependencies' 0; propagatedNativeBuildInputs = lib.elemAt propagatedDependencies' 0;
propagatedBuildInputs = lib.elemAt propagatedDependencies' 1; propagatedBuildInputs = lib.elemAt propagatedDependencies' 1;
} // lib.optionalAttrs (hostPlatform.isDarwin) { } // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) {
# TODO: remove lib.unique once nix has a list canonicalization primitive # TODO: remove lib.unique once nix has a list canonicalization primitive
__sandboxProfile = __sandboxProfile =
let profiles = [ stdenv.extraSandboxProfile ] ++ computedSandboxProfile ++ computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile sandboxProfile ]; let profiles = [ stdenv.extraSandboxProfile ] ++ computedSandboxProfile ++ computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile sandboxProfile ];
@ -139,7 +135,9 @@ rec {
{ {
inherit lib config meta derivationArg; inherit lib config meta derivationArg;
mkDerivationArg = attrs; mkDerivationArg = attrs;
inherit (stdenv) system; # TODO: cross-compilation? # Nix itself uses the `system` field of a derivation to decide where
# to build it. This is a bit confusing for cross compilation.
inherit (stdenv) system;
})) }))
( { ( {
overrideAttrs = f: mkDerivation (attrs // (f attrs)); overrideAttrs = f: mkDerivation (attrs // (f attrs));

View file

@ -52,8 +52,11 @@ let
let let
thisStdenv = import ../generic { thisStdenv = import ../generic {
inherit config extraBuildInputs;
name = "stdenv-linux-boot"; name = "stdenv-linux-boot";
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config extraBuildInputs;
preHook = preHook =
'' ''
# Don't patch #!/interpreter because it leads to retained # Don't patch #!/interpreter because it leads to retained
@ -64,9 +67,6 @@ let
shell = "${bootstrapTools}/bin/bash"; shell = "${bootstrapTools}/bin/bash";
initialPath = [bootstrapTools]; initialPath = [bootstrapTools];
hostPlatform = localSystem;
targetPlatform = localSystem;
fetchurlBoot = import ../../build-support/fetchurl/boot.nix { fetchurlBoot = import ../../build-support/fetchurl/boot.nix {
inherit system; inherit system;
}; };
@ -76,8 +76,6 @@ let
else lib.makeOverridable (import ../../build-support/cc-wrapper) { else lib.makeOverridable (import ../../build-support/cc-wrapper) {
nativeTools = false; nativeTools = false;
nativeLibc = false; nativeLibc = false;
hostPlatform = localSystem;
targetPlatform = localSystem;
cc = prevStage.gcc-unwrapped; cc = prevStage.gcc-unwrapped;
isGNU = true; isGNU = true;
libc = prevStage.glibc; libc = prevStage.glibc;
@ -99,9 +97,6 @@ let
}; };
in { in {
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config overlays; inherit config overlays;
stdenv = thisStdenv; stdenv = thisStdenv;
}; };
@ -241,8 +236,6 @@ in
nativeTools = false; nativeTools = false;
nativeLibc = false; nativeLibc = false;
isGNU = true; isGNU = true;
hostPlatform = localSystem;
targetPlatform = localSystem;
cc = prevStage.gcc-unwrapped; cc = prevStage.gcc-unwrapped;
libc = self.glibc; libc = self.glibc;
inherit (self) stdenv binutils coreutils gnugrep; inherit (self) stdenv binutils coreutils gnugrep;
@ -263,11 +256,11 @@ in
# dependency (`nix-store -qR') on bootstrapTools or the first # dependency (`nix-store -qR') on bootstrapTools or the first
# binutils built. # binutils built.
(prevStage: { (prevStage: {
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config overlays; inherit config overlays;
stdenv = import ../generic rec { stdenv = import ../generic rec {
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config; inherit config;
preHook = '' preHook = ''
@ -280,9 +273,6 @@ in
initialPath = initialPath =
((import ../common-path.nix) {pkgs = prevStage;}); ((import ../common-path.nix) {pkgs = prevStage;});
hostPlatform = localSystem;
targetPlatform = localSystem;
extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++ extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64. # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook; lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;

View file

@ -81,6 +81,7 @@ let
{ cc, fetchurl, extraPath ? [], overrides ? (self: super: { }) }: { cc, fetchurl, extraPath ? [], overrides ? (self: super: { }) }:
import ../generic { import ../generic {
buildPlatform = localSystem;
hostPlatform = localSystem; hostPlatform = localSystem;
targetPlatform = localSystem; targetPlatform = localSystem;
@ -125,8 +126,6 @@ in
"i686-solaris" = "/usr/gnu"; "i686-solaris" = "/usr/gnu";
"x86_64-solaris" = "/opt/local/gcc47"; "x86_64-solaris" = "/opt/local/gcc47";
}.${system} or "/usr"; }.${system} or "/usr";
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit stdenv; inherit stdenv;
}; };
@ -140,9 +139,6 @@ in
# First build a stdenv based only on tools outside the store. # First build a stdenv based only on tools outside the store.
(prevStage: { (prevStage: {
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config overlays; inherit config overlays;
stdenv = makeStdenv { stdenv = makeStdenv {
inherit (prevStage) cc fetchurl; inherit (prevStage) cc fetchurl;
@ -152,9 +148,6 @@ in
# Using that, build a stdenv that adds the xz command (which most systems # Using that, build a stdenv that adds the xz command (which most systems
# don't have, so we mustn't rely on the native environment providing it). # don't have, so we mustn't rely on the native environment providing it).
(prevStage: { (prevStage: {
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config overlays; inherit config overlays;
stdenv = makeStdenv { stdenv = makeStdenv {
inherit (prevStage.stdenv) cc fetchurl; inherit (prevStage.stdenv) cc fetchurl;

View file

@ -10,10 +10,13 @@ bootStages ++ [
(prevStage: let (prevStage: let
inherit (prevStage) stdenv; inherit (prevStage) stdenv;
in { in {
inherit (prevStage) buildPlatform hostPlatform targetPlatform;
inherit config overlays; inherit config overlays;
stdenv = import ../generic rec { stdenv = import ../generic rec {
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit config; inherit config;
preHook = '' preHook = ''
@ -30,8 +33,6 @@ bootStages ++ [
nativeTools = false; nativeTools = false;
nativePrefix = stdenv.lib.optionalString hostPlatform.isSunOS "/usr"; nativePrefix = stdenv.lib.optionalString hostPlatform.isSunOS "/usr";
nativeLibc = true; nativeLibc = true;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit stdenv; inherit stdenv;
inherit (prevStage) binutils coreutils gnugrep; inherit (prevStage) binutils coreutils gnugrep;
cc = prevStage.gcc.cc; cc = prevStage.gcc.cc;

View file

@ -18,30 +18,6 @@
, # Use to reevaluate Nixpkgs; a dirty hack that should be removed , # Use to reevaluate Nixpkgs; a dirty hack that should be removed
nixpkgsFun nixpkgsFun
## Platform parameters
##
## The "build" "host" "target" terminology below comes from GNU Autotools. See
## its documentation for more information on what those words mean. Note that
## each should always be defined, even when not cross compiling.
##
## For purposes of bootstrapping, think of each stage as a "sliding window"
## over a list of platforms. Specifically, the host platform of the previous
## stage becomes the build platform of the current one, and likewise the
## target platform of the previous stage becomes the host platform of the
## current one.
##
, # The platform on which packages are built. Consists of `system`, a
# string (e.g.,`i686-linux') identifying the most import attributes of the
# build platform, and `platform` a set of other details.
buildPlatform
, # The platform on which packages run.
hostPlatform
, # The platform which build tools (especially compilers) build for in this stage,
targetPlatform
## Other parameters ## Other parameters
## ##
@ -69,10 +45,10 @@
, # Non-GNU/Linux OSes are currently "impure" platforms, with their libc , # Non-GNU/Linux OSes are currently "impure" platforms, with their libc
# outside of the store. Thus, GCC, GFortran, & co. must always look for files # outside of the store. Thus, GCC, GFortran, & co. must always look for files
# in standard system directories (/usr/include, etc.) # in standard system directories (/usr/include, etc.)
noSysDirs ? buildPlatform.system != "x86_64-freebsd" noSysDirs ? stdenv.buildPlatform.system != "x86_64-freebsd"
&& buildPlatform.system != "i686-freebsd" && stdenv.buildPlatform.system != "i686-freebsd"
&& buildPlatform.system != "x86_64-solaris" && stdenv.buildPlatform.system != "x86_64-solaris"
&& buildPlatform.system != "x86_64-kfreebsd-gnu" && stdenv.buildPlatform.system != "x86_64-kfreebsd-gnu"
, # The configuration attribute set , # The configuration attribute set
config config
@ -98,19 +74,18 @@ let
// { recurseForDerivations = false; }; // { recurseForDerivations = false; };
__targetPackages = (if __targetPackages == null then self else __targetPackages) __targetPackages = (if __targetPackages == null then self else __targetPackages)
// { recurseForDerivations = false; }; // { recurseForDerivations = false; };
inherit stdenv inherit stdenv;
buildPlatform hostPlatform targetPlatform;
}; };
# The old identifiers for cross-compiling. These should eventually be removed, # The old identifiers for cross-compiling. These should eventually be removed,
# and the packages that rely on them refactored accordingly. # and the packages that rely on them refactored accordingly.
platformCompat = self: super: let platformCompat = self: super: let
# TODO(@Ericson2314) this causes infinite recursion inherit (super.stdenv) buildPlatform hostPlatform targetPlatform;
#inherit (self) buildPlatform hostPlatform targetPlatform;
in { in {
stdenv = super.stdenv // { stdenv = super.stdenv // {
inherit (buildPlatform) platform; inherit (super.stdenv.buildPlatform) platform;
}; };
inherit buildPlatform hostPlatform targetPlatform;
inherit (buildPlatform) system platform; inherit (buildPlatform) system platform;
}; };