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: jakehamilton
GPG key ID: 9762169A1B35EA68

View file

@ -8,9 +8,32 @@
generic = config.packages.generic;
targeted = {
i686-linux = generic;
getPackages = system:
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 {
includes = [
# ./aux/foundation.nix
@ -34,16 +57,19 @@ in {
generic = {
example = {
x = {
meta.platforms = ["i686-linux" "x86_64-linux"];
version = "1.0.0";
builder.build = package:
derivation {
name = package.name;
builder = "/bin/sh";
system = package.platform.build;
};
phases = {
build = ''
make
build = package: ''
make --build ${package.platform.build} --host ${package.platform.host}
'';
install = lib.dag.entry.after ["build"] ''