nixpkgs-suyu/pkgs/stdenv/cross/default.nix
John Ericson 39753f5360 top-level: Close over fewer arguments for stdenv stages
This makes the flow of data easier to understand. There's little downside
because the args in question are already inspected by the stdenvs.

cross-compiling in particular is simpler because we don't need to worry
about overriding the config closed over by `allPackages`.
2016-11-30 19:11:03 -05:00

35 lines
1.2 KiB
Nix

{ lib, allPackages
, system, platform, crossSystem, config
}:
rec {
vanillaStdenv = (import ../. {
inherit lib allPackages system platform;
crossSystem = null;
# Ignore custom stdenvs when cross compiling for compatability
config = builtins.removeAttrs config [ "replaceStdenv" ];
}) // {
# Needed elsewhere as a hacky way to pass the target
cross = crossSystem;
};
# For now, this is just used to build the native stdenv. Eventually, it should
# be used to build compilers and other such tools targeting the cross
# platform. Then, `forceNativeDrv` can be removed.
buildPackages = allPackages {
inherit system platform crossSystem config;
# It's OK to change the built-time dependencies
allowCustomOverrides = true;
stdenv = vanillaStdenv;
};
stdenvCross = buildPackages.makeStdenvCross
buildPackages.stdenv crossSystem
buildPackages.binutilsCross buildPackages.gccCrossStageFinal;
stdenvCrossiOS = 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;
}