feat: dynamic cross packages generation

This commit is contained in:
Jake Hamilton 2024-06-14 01:40:46 -07:00
parent ea0ed58a7e
commit e1321add05
Signed by untrusted user: jakehamilton
GPG key ID: 9762169A1B35EA68

View file

@ -8,9 +8,32 @@
generic = config.packages.generic; generic = config.packages.generic;
targeted = { getPackages = system:
i686-linux = generic; builtins.mapAttrs
(
namespace: packages:
lib.attrs.filter
(name: package: builtins.elem system package.meta.platforms)
packages
);
targeted' = {
i686-linux =
getPackages "i686-linux" generic
// {
cross = {
x86_64-linux = getPackages "x86_64-linux" generic;
};
};
}; };
targeted = lib.attrs.generate lib'.systems.doubles.all (system:
getPackages system generic
// {
cross = lib.attrs.generate doubles (
host: getPackages host generic
);
});
in { in {
includes = [ includes = [
# ./aux/foundation.nix # ./aux/foundation.nix
@ -34,16 +57,19 @@ in {
generic = { generic = {
example = { example = {
x = { x = {
meta.platforms = ["i686-linux" "x86_64-linux"];
version = "1.0.0"; version = "1.0.0";
builder.build = package: builder.build = package:
derivation { derivation {
name = package.name; name = package.name;
builder = "/bin/sh"; builder = "/bin/sh";
system = package.platform.build; system = package.platform.build;
}; };
phases = { phases = {
build = '' build = package: ''
make make --build ${package.platform.build} --host ${package.platform.host}
''; '';
install = lib.dag.entry.after ["build"] '' install = lib.dag.entry.after ["build"] ''