nixpkgs/pkgs/stdenv/cross/default.nix
John Ericson 92edcb7ebb top-level: Lay the groundwork for {build,host,target}Platform
The long term goal is a big replace:
  { inherit system platform; } => buildPlatform
  crossSystem => hostPlatform
  stdenv.cross => targetPlatform
And additionally making sure each is defined even when not cross compiling.

This commit refactors the bootstrapping code along that vision, but leaves
the old identifiers with their null semantics in place so packages can be
modernized incrementally.
2017-01-24 11:37:56 -05:00

52 lines
1.4 KiB
Nix

{ lib
, localSystem, crossSystem, config, overlays
}:
let
bootStages = import ../. {
inherit lib localSystem overlays;
crossSystem = null;
# Ignore custom stdenvs when cross compiling for compatability
config = builtins.removeAttrs config [ "replaceStdenv" ];
};
in bootStages ++ [
# Build Packages
(vanillaPackages: {
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = crossSystem;
inherit config overlays;
# Should be false, but we're trying to preserve hashes for now
selfBuild = true;
# It's OK to change the built-time dependencies
allowCustomOverrides = true;
stdenv = vanillaPackages.stdenv // {
overrides = _: _: {};
};
})
# Run Packages
(buildPackages: {
buildPlatform = localSystem;
hostPlatform = crossSystem;
targetPlatform = crossSystem;
inherit config overlays;
selfBuild = false;
stdenv = if crossSystem.useiOSCross or false
then let
inherit (buildPackages.darwin.ios-cross {
prefix = crossSystem.config;
inherit (crossSystem) arch;
simulator = crossSystem.isiPhoneSimulator or false; })
cc binutils;
in buildPackages.makeStdenvCross
buildPackages.stdenv crossSystem
binutils cc
else buildPackages.makeStdenvCross
buildPackages.stdenv crossSystem
buildPackages.binutilsCross buildPackages.gccCrossStageFinal;
})
]