feat(services): introduce structured bundles
Some checks failed
build liminix / build_vm_qemu_mips (push) Failing after 27s
Some checks failed
build liminix / build_vm_qemu_mips (push) Failing after 27s
Structured bundles keep their original contents as a `passthru` field named `components`. This enable users to depend on a specific piece of the bundle instead of the whole bundle. Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
This commit is contained in:
parent
ebcdbf76bc
commit
0fb671023c
2 changed files with 18 additions and 4 deletions
|
@ -7,7 +7,7 @@
|
||||||
{ members, primary } :
|
{ members, primary } :
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (liminix.services) bundle oneshot;
|
inherit (liminix.services) structuredBundle oneshot;
|
||||||
inherit (lib) mapAttrs;
|
inherit (lib) mapAttrs;
|
||||||
addif = name: { dependencies ? [ ], member }: oneshot {
|
addif = name: { dependencies ? [ ], member }: oneshot {
|
||||||
name = "${primary.name}.member.${name}";
|
name = "${primary.name}.member.${name}";
|
||||||
|
@ -22,7 +22,7 @@ let
|
||||||
|
|
||||||
dependencies = [ primary member ] ++ dependencies;
|
dependencies = [ primary member ] ++ dependencies;
|
||||||
};
|
};
|
||||||
in bundle {
|
in structuredBundle {
|
||||||
name = "${primary.name}.members";
|
name = "${primary.name}.members";
|
||||||
contents = builtins.attrValues (mapAttrs addif members);
|
contents = mapAttrs addif members;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ let
|
||||||
, contents ? []
|
, contents ? []
|
||||||
, buildInputs ? []
|
, buildInputs ? []
|
||||||
, isTrigger ? false
|
, isTrigger ? false
|
||||||
|
, passthru ? {}
|
||||||
} @ args:
|
} @ args:
|
||||||
stdenvNoCC.mkDerivation {
|
stdenvNoCC.mkDerivation {
|
||||||
# we use stdenvNoCC to avoid generating derivations with names
|
# we use stdenvNoCC to avoid generating derivations with names
|
||||||
|
@ -50,6 +51,8 @@ let
|
||||||
dependencies = builtins.map (d: d.name) dependencies;
|
dependencies = builtins.map (d: d.name) dependencies;
|
||||||
contents = builtins.map (d: d.name) contents;
|
contents = builtins.map (d: d.name) contents;
|
||||||
builder = ./builder.sh;
|
builder = ./builder.sh;
|
||||||
|
|
||||||
|
inherit passthru;
|
||||||
};
|
};
|
||||||
|
|
||||||
longrun = {
|
longrun = {
|
||||||
|
@ -100,7 +103,18 @@ let
|
||||||
serviceType = "bundle";
|
serviceType = "bundle";
|
||||||
inherit contents dependencies;
|
inherit contents dependencies;
|
||||||
});
|
});
|
||||||
|
structuredBundle = {
|
||||||
|
name
|
||||||
|
, contents ? {}
|
||||||
|
, dependencies ? []
|
||||||
|
, ...
|
||||||
|
} @ args: service (args // {
|
||||||
|
serviceType = "bundle";
|
||||||
|
contents = builtins.attrValues contents;
|
||||||
|
inherit dependencies;
|
||||||
|
passthru.components = contents;
|
||||||
|
});
|
||||||
target = bundle;
|
target = bundle;
|
||||||
in {
|
in {
|
||||||
inherit target bundle oneshot longrun output;
|
inherit target bundle oneshot longrun output structuredBundle;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue