feat(clanLib): init evalServiceSchema

This commit is contained in:
Johannes Kirschbauer
2025-05-05 21:55:29 +02:00
parent acc6797c22
commit e44d34ef99
5 changed files with 30 additions and 21 deletions

View File

@@ -206,19 +206,7 @@ in
inherit inventoryClass;
# Endpoint that can be called to get a service schema
evalServiceSchema =
{moduleSpec}:
let
resolvedModule = clan-core.clanLib.inventory.resolveModule {
inherit moduleSpec;
flakeInputs = config.self.inputs;
localModuleSet = config.inventory.modules;
};
in
(clan-core.clanLib.inventory.evalClanService {
modules = [ resolvedModule ];
prefix = [ ];
}).config.result.api.schema;
evalServiceSchema = clan-core.clanLib.evalServiceSchema config.self;
# TODO: unify this interface
# We should have only clan.modules. (consistent with clan.templates)

View File

@@ -15,10 +15,27 @@ lib.fix (clanLib: {
*/
callLib = file: args: import file ({ inherit lib clanLib; } // args);
# ------------------------------------
buildClan = clanLib.buildClanModule.buildClanWith {
clan-core = self;
inherit nixpkgs nix-darwin;
};
evalServiceSchema =
self:
{
moduleSpec,
flakeInputs ? self.inputs,
localModuleSet ? self.clan.modules,
}:
let
resolvedModule = clanLib.inventory.resolveModule {
inherit moduleSpec flakeInputs localModuleSet;
};
in
(clanLib.inventory.evalClanService {
modules = [ resolvedModule ];
prefix = [ ];
}).config.result.api.schema;
# ------------------------------------
# ClanLib functions
evalClan = clanLib.callLib ./inventory/eval-clan-modules { };

View File

@@ -62,7 +62,8 @@ let
'');
clanAttrs =
input.clan or (throw "It seems the flake input ${moduleSpec.input} doesn't export any clan resources");
input.clan
or (throw "It seems the flake input ${moduleSpec.input} doesn't export any clan resources");
in
clanAttrs.modules;