fix: cross-platform deps

This commit is contained in:
Jake Hamilton 2024-07-03 02:43:27 -07:00
parent 0e03546da5
commit bd51f4a088
Signed by: jakehamilton
GPG key ID: 9762169A1B35EA68
5 changed files with 39 additions and 3 deletions

View file

@ -83,6 +83,7 @@ in {
} }
); );
in in
(builtins.trace "${package.name}: ${system}")
built built
// { // {
inherit (package) meta; inherit (package) meta;

View file

@ -28,7 +28,8 @@ in {
# platform.host = lib.modules.overrides.force "x86_64-linux"; # platform.host = lib.modules.overrides.force "x86_64-linux";
# }; # };
# example-x = config.packages.example.x; # example-x = config.packages.example.x;
# cross-example-x-x86_64-linux = config.packages.cross.x86_64-linux.example.x; cross-aux-a-x86_64-linux = config.packages.cross.x86_64-linux.aux.a;
cross-foundation-gcc-x86_64-linux = config.packages.cross.x86_64-linux.foundation.gcc;
}; };
}; };

View file

@ -55,7 +55,31 @@ in {
]; ];
}; };
resolved = result.config; # Not all platform information can be effectively handled via submodules. To handle
# the case where a user copies the resolved config over we need to ensure that
# dependencies are appropriately updated.
resolved =
result.config
// {
deps = {
build = {
only = buildDependencies build build build package.deps.build.only;
build = buildDependencies build build target package.deps.build.build;
host = buildDependencies build host target package.deps.build.host;
target = buildDependencies build target target package.deps.build.target;
};
host = {
only = buildDependencies host host host package.deps.host.only;
host = buildDependencies host host target package.deps.host.host;
target = buildDependencies host target target package.deps.host.target;
};
target = {
only = buildDependencies target target target package.deps.target.only;
target = buildDependencies target target target package.deps.target.target;
};
};
};
in in
resolved resolved
// { // {

View file

@ -80,6 +80,7 @@ in {
transform = value: let transform = value: let
package = lib'.packages.resolve value; package = lib'.packages.resolve value;
in in
(builtins.trace "building dependency ${package.name}: build=${build.triple} host=${host.triple} target=${target.triple}")
lib'.packages.build package build host target; lib'.packages.build package build host target;
in in
lib.types.attrs.of (lib.types.coerce initial transform lib'.types.package); lib.types.attrs.of (lib.types.coerce initial transform lib'.types.package);

View file

@ -47,7 +47,16 @@ in {
builtins.mapAttrs ( builtins.mapAttrs (
name: alias: let name: alias: let
setHost = package: setHost = package:
package; package // {
__modules__ = package.__modules__ ++ [
{
config.platform = {
host = lib.modules.override 5 system;
target = lib.modules.override 5 system;
};
}
];
};
# if package != {} # if package != {}
# then # then
# (package.extend ( # (package.extend (