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.
(cherry picked from commit a3a6ad7a01
)
This commit is contained in:
parent
2a1c0dde8f
commit
e84255296f
9 changed files with 28 additions and 20 deletions
|
@ -1,11 +1,14 @@
|
||||||
{ lib
|
{ lib
|
||||||
, localSystem, crossSystem, config, overlays
|
, localSystem, crossSystem, config, overlays, crossOverlays ? []
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
bootStages = import ../. {
|
bootStages = import ../. {
|
||||||
inherit lib localSystem overlays;
|
inherit lib localSystem overlays;
|
||||||
crossSystem = null;
|
|
||||||
|
crossSystem = localSystem;
|
||||||
|
crossOverlays = [];
|
||||||
|
|
||||||
# Ignore custom stdenvs when cross compiling for compatability
|
# Ignore custom stdenvs when cross compiling for compatability
|
||||||
config = builtins.removeAttrs config [ "replaceStdenv" ];
|
config = builtins.removeAttrs config [ "replaceStdenv" ];
|
||||||
};
|
};
|
||||||
|
@ -33,7 +36,8 @@ in lib.init bootStages ++ [
|
||||||
|
|
||||||
# Run Packages
|
# Run Packages
|
||||||
(buildPackages: {
|
(buildPackages: {
|
||||||
inherit config overlays;
|
inherit config;
|
||||||
|
overlays = overlays ++ crossOverlays;
|
||||||
selfBuild = false;
|
selfBuild = false;
|
||||||
stdenv = buildPackages.stdenv.override (old: rec {
|
stdenv = buildPackages.stdenv.override (old: rec {
|
||||||
buildPlatform = localSystem;
|
buildPlatform = localSystem;
|
||||||
|
@ -48,7 +52,7 @@ in lib.init bootStages ++ [
|
||||||
|
|
||||||
cc = if crossSystem.useiOSPrebuilt or false
|
cc = if crossSystem.useiOSPrebuilt or false
|
||||||
then buildPackages.darwin.iosSdkPkgs.clang
|
then buildPackages.darwin.iosSdkPkgs.clang
|
||||||
else if crossSystem.useAndroidPrebuilt
|
else if crossSystem.useAndroidPrebuilt or false
|
||||||
then buildPackages.androidenv."androidndkPkgs_${crossSystem.ndkVer}".gcc
|
then buildPackages.androidenv."androidndkPkgs_${crossSystem.ndkVer}".gcc
|
||||||
else buildPackages.gcc;
|
else buildPackages.gcc;
|
||||||
|
|
||||||
|
@ -56,6 +60,7 @@ in lib.init bootStages ++ [
|
||||||
++ lib.optionals
|
++ lib.optionals
|
||||||
(hostPlatform.isLinux && !buildPlatform.isLinux)
|
(hostPlatform.isLinux && !buildPlatform.isLinux)
|
||||||
[ buildPackages.patchelf buildPackages.paxctl ]
|
[ buildPackages.patchelf buildPackages.paxctl ]
|
||||||
|
++ lib.optional hostPlatform.isDarwin buildPackages.clang
|
||||||
++ lib.optional
|
++ lib.optional
|
||||||
(let f = p: !p.isx86 || p.libc == "musl"; in f hostPlatform && !(f buildPlatform))
|
(let f = p: !p.isx86 || p.libc == "musl"; in f hostPlatform && !(f buildPlatform))
|
||||||
buildPackages.updateAutotoolsGnuConfigScriptsHook
|
buildPackages.updateAutotoolsGnuConfigScriptsHook
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
, localSystem, crossSystem, config, overlays
|
, localSystem, crossSystem, config, overlays
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert crossSystem == null;
|
assert crossSystem == localSystem;
|
||||||
|
|
||||||
let
|
let
|
||||||
bootStages = import ../. {
|
bootStages = import ../. {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{ lib
|
{ lib
|
||||||
, localSystem, crossSystem, config, overlays
|
, localSystem, crossSystem, config, overlays, crossOverlays ? []
|
||||||
|
|
||||||
# Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools
|
# Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools
|
||||||
, bootstrapFiles ? let
|
, bootstrapFiles ? let
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
}
|
}
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert crossSystem == null;
|
assert crossSystem == localSystem;
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (localSystem) system platform;
|
inherit (localSystem) system platform;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{ # Args just for stdenvs' usage
|
{ # Args just for stdenvs' usage
|
||||||
lib
|
lib
|
||||||
# Args to pass on to the pkgset builder, too
|
# Args to pass on to the pkgset builder, too
|
||||||
, localSystem, crossSystem, config, overlays
|
, localSystem, crossSystem, config, overlays, crossOverlays ? []
|
||||||
} @ args:
|
} @ args:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -36,7 +36,7 @@ let
|
||||||
|
|
||||||
# Select the appropriate stages for the platform `system'.
|
# Select the appropriate stages for the platform `system'.
|
||||||
in
|
in
|
||||||
if crossSystem != null then stagesCross
|
if crossSystem != localSystem || crossOverlays != [] then stagesCross
|
||||||
else if config ? replaceStdenv then stagesCustom
|
else if config ? replaceStdenv then stagesCustom
|
||||||
else { # switch
|
else { # switch
|
||||||
"i686-linux" = stagesLinux;
|
"i686-linux" = stagesLinux;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
, localSystem, crossSystem, config, overlays
|
, localSystem, crossSystem, config, overlays
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert crossSystem == null;
|
assert crossSystem == localSystem;
|
||||||
let inherit (localSystem) system; in
|
let inherit (localSystem) system; in
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# compiler and linker that do not search in default locations,
|
# compiler and linker that do not search in default locations,
|
||||||
# ensuring purity of components produced by it.
|
# ensuring purity of components produced by it.
|
||||||
{ lib
|
{ lib
|
||||||
, localSystem, crossSystem, config, overlays
|
, localSystem, crossSystem, config, overlays, crossOverlays ? []
|
||||||
|
|
||||||
, bootstrapFiles ?
|
, bootstrapFiles ?
|
||||||
let table = {
|
let table = {
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
in files
|
in files
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert crossSystem == null;
|
assert crossSystem == localSystem;
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (localSystem) system platform;
|
inherit (localSystem) system platform;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
, localSystem, crossSystem, config, overlays
|
, localSystem, crossSystem, config, overlays
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert crossSystem == null;
|
assert crossSystem == localSystem;
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (localSystem) system;
|
inherit (localSystem) system;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{ lib
|
{ lib
|
||||||
, crossSystem, config, overlays
|
, crossSystem, localSystem, config, overlays
|
||||||
, bootStages
|
, bootStages
|
||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert crossSystem == null;
|
assert crossSystem == localSystem;
|
||||||
|
|
||||||
bootStages ++ [
|
bootStages ++ [
|
||||||
(prevStage: {
|
(prevStage: {
|
||||||
|
|
|
@ -22,9 +22,8 @@
|
||||||
# `*Platform`s.
|
# `*Platform`s.
|
||||||
localSystem
|
localSystem
|
||||||
|
|
||||||
, # The system packages will ultimately be run on. Null if the two should be the
|
, # The system packages will ultimately be run on.
|
||||||
# same.
|
crossSystem ? localSystem
|
||||||
crossSystem ? null
|
|
||||||
|
|
||||||
, # Allow a configuration attribute set to be passed in as an argument.
|
, # Allow a configuration attribute set to be passed in as an argument.
|
||||||
config ? {}
|
config ? {}
|
||||||
|
@ -32,6 +31,9 @@
|
||||||
, # List of overlays layers used to extend Nixpkgs.
|
, # List of overlays layers used to extend Nixpkgs.
|
||||||
overlays ? []
|
overlays ? []
|
||||||
|
|
||||||
|
, # List of overlays to apply to target packages only.
|
||||||
|
crossOverlays ? []
|
||||||
|
|
||||||
, # A function booting the final package set for a specific standard
|
, # A function booting the final package set for a specific standard
|
||||||
# environment. See below for the arguments given to that function, the type of
|
# environment. See below for the arguments given to that function, the type of
|
||||||
# list it returns.
|
# list it returns.
|
||||||
|
@ -61,7 +63,8 @@ in let
|
||||||
builtins.intersectAttrs { platform = null; } config
|
builtins.intersectAttrs { platform = null; } config
|
||||||
// args.localSystem);
|
// args.localSystem);
|
||||||
|
|
||||||
crossSystem = lib.mapNullable lib.systems.elaborate crossSystem0;
|
crossSystem = if crossSystem0 == null then localSystem
|
||||||
|
else lib.systems.elaborate crossSystem0;
|
||||||
|
|
||||||
# A few packages make a new package set to draw their dependencies from.
|
# A few packages make a new package set to draw their dependencies from.
|
||||||
# (Currently to get a cross tool chain, or forced-i686 package.) Rather than
|
# (Currently to get a cross tool chain, or forced-i686 package.) Rather than
|
||||||
|
@ -91,7 +94,7 @@ in let
|
||||||
boot = import ../stdenv/booter.nix { inherit lib allPackages; };
|
boot = import ../stdenv/booter.nix { inherit lib allPackages; };
|
||||||
|
|
||||||
stages = stdenvStages {
|
stages = stdenvStages {
|
||||||
inherit lib localSystem crossSystem config overlays;
|
inherit lib localSystem crossSystem config overlays crossOverlays;
|
||||||
};
|
};
|
||||||
|
|
||||||
pkgs = boot stages;
|
pkgs = boot stages;
|
||||||
|
|
Loading…
Reference in a new issue