stdenv: implement crossOverlays
crossOverlays only apply to the packages being built, not the build packages. It is useful when you don’t care what is used to build your packages, just what is being built. The idea relies heavily on the cross compiling infrastructure. Using this implies that we need to create a cross stdenv.
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
{ lib
|
||||
, localSystem, crossSystem, config, overlays
|
||||
, localSystem, crossSystem, config, overlays, crossOverlays ? []
|
||||
}:
|
||||
|
||||
let
|
||||
bootStages = import ../. {
|
||||
inherit lib localSystem overlays;
|
||||
crossSystem = null;
|
||||
|
||||
crossSystem = localSystem;
|
||||
crossOverlays = [];
|
||||
|
||||
# Ignore custom stdenvs when cross compiling for compatability
|
||||
config = builtins.removeAttrs config [ "replaceStdenv" ];
|
||||
};
|
||||
@@ -33,7 +36,8 @@ in lib.init bootStages ++ [
|
||||
|
||||
# Run Packages
|
||||
(buildPackages: {
|
||||
inherit config overlays;
|
||||
inherit config;
|
||||
overlays = overlays ++ crossOverlays;
|
||||
selfBuild = false;
|
||||
stdenv = buildPackages.stdenv.override (old: rec {
|
||||
buildPlatform = localSystem;
|
||||
@@ -48,7 +52,7 @@ in lib.init bootStages ++ [
|
||||
|
||||
cc = if crossSystem.useiOSPrebuilt or false
|
||||
then buildPackages.darwin.iosSdkPkgs.clang
|
||||
else if crossSystem.useAndroidPrebuilt
|
||||
else if crossSystem.useAndroidPrebuilt or false
|
||||
then buildPackages.androidenv."androidndkPkgs_${crossSystem.ndkVer}".gcc
|
||||
else buildPackages.gcc;
|
||||
|
||||
@@ -56,6 +60,7 @@ in lib.init bootStages ++ [
|
||||
++ lib.optionals
|
||||
(hostPlatform.isLinux && !buildPlatform.isLinux)
|
||||
[ buildPackages.patchelf buildPackages.paxctl ]
|
||||
++ lib.optional hostPlatform.isDarwin buildPackages.clang
|
||||
++ lib.optional
|
||||
(let f = p: !p.isx86 || p.libc == "musl"; in f hostPlatform && !(f buildPlatform))
|
||||
buildPackages.updateAutotoolsGnuConfigScriptsHook
|
||||
|
||||
Reference in New Issue
Block a user