inventory: add clanLib to specialArgs
This commit is contained in:
committed by
Mic92
parent
5b399fd447
commit
3d0c281fd6
@@ -27,14 +27,16 @@ in
|
||||
placeholder = "mappedServiceName";
|
||||
elemType = submoduleWith {
|
||||
class = "clan.service";
|
||||
specialArgs = {
|
||||
exports = config.exports;
|
||||
directory = directory;
|
||||
clanLib = specialArgs.clanLib;
|
||||
};
|
||||
modules = [
|
||||
(
|
||||
{ name, ... }:
|
||||
{
|
||||
_module.args._ctx = [ name ];
|
||||
_module.args.exports = config.exports;
|
||||
_module.args.directory = directory;
|
||||
|
||||
}
|
||||
)
|
||||
./service-module.nix
|
||||
|
||||
@@ -56,6 +56,7 @@ in
|
||||
extraModules = import ./extraModules.nix { inherit clanLib; };
|
||||
exports = import ./exports.nix { inherit lib clanLib; };
|
||||
settings = import ./settings.nix { inherit lib callInventoryAdapter; };
|
||||
specialArgs = import ./specialArgs.nix { inherit lib callInventoryAdapter; };
|
||||
resolve_module_spec = import ./import_module_spec.nix { inherit lib callInventoryAdapter; };
|
||||
test_simple =
|
||||
let
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
{ callInventoryAdapter, lib, ... }:
|
||||
let
|
||||
res = callInventoryAdapter {
|
||||
modules."A" = m: {
|
||||
_class = "clan.service";
|
||||
config = {
|
||||
manifest = {
|
||||
name = "network";
|
||||
};
|
||||
roles.default = { };
|
||||
|
||||
};
|
||||
options.test = lib.mkOption {
|
||||
default = m;
|
||||
};
|
||||
};
|
||||
machines = {
|
||||
jon = { };
|
||||
};
|
||||
instances."instance_foo" = {
|
||||
module = {
|
||||
name = "A";
|
||||
input = "self";
|
||||
};
|
||||
roles.peer.machines.jon = { };
|
||||
};
|
||||
};
|
||||
|
||||
specialArgs = lib.attrNames res.servicesEval.config.mappedServices.self-A.test.specialArgs;
|
||||
in
|
||||
{
|
||||
test_simple = {
|
||||
expr = specialArgs;
|
||||
expected = [
|
||||
"clanLib"
|
||||
"directory"
|
||||
"exports"
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user