feat: dynamic cross packages generation
This commit is contained in:
parent
ea0ed58a7e
commit
e1321add05
|
@ -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"] ''
|
||||
|
|
Loading…
Reference in a new issue