Merge pull request 'api-1' (#3524) from hsjobeki/clan-core:api-1 into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3524
This commit is contained in:
@@ -45,6 +45,7 @@ let
|
|||||||
inherit inventory directory;
|
inherit inventory directory;
|
||||||
flakeInputs = config.self.inputs;
|
flakeInputs = config.self.inputs;
|
||||||
prefix = config._prefix ++ [ "inventoryClass" ];
|
prefix = config._prefix ++ [ "inventoryClass" ];
|
||||||
|
localModuleSet = config.self.clan.modules;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ let
|
|||||||
directory,
|
directory,
|
||||||
flakeInputs,
|
flakeInputs,
|
||||||
prefix ? [ ],
|
prefix ? [ ],
|
||||||
|
localModuleSet ? { },
|
||||||
}:
|
}:
|
||||||
(lib.evalModules {
|
(lib.evalModules {
|
||||||
# TODO: remove clanLib from specialArgs
|
# TODO: remove clanLib from specialArgs
|
||||||
@@ -21,6 +22,9 @@ let
|
|||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
./builder
|
./builder
|
||||||
|
(lib.modules.importApply ./service-list-from-inputs.nix {
|
||||||
|
inherit flakeInputs clanLib localModuleSet;
|
||||||
|
})
|
||||||
{ inherit directory inventory; }
|
{ inherit directory inventory; }
|
||||||
(
|
(
|
||||||
# config.distributedServices.allMachines.${name} or [ ];
|
# config.distributedServices.allMachines.${name} or [ ];
|
||||||
|
|||||||
43
lib/inventory/build-inventory/service-list-from-inputs.nix
Normal file
43
lib/inventory/build-inventory/service-list-from-inputs.nix
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
flakeInputs,
|
||||||
|
clanLib,
|
||||||
|
localModuleSet,
|
||||||
|
}:
|
||||||
|
{ lib, config, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
inspectModule =
|
||||||
|
inputName: moduleName: module:
|
||||||
|
let
|
||||||
|
eval = clanLib.inventory.evalClanService {
|
||||||
|
modules = [ module ];
|
||||||
|
prefix = [
|
||||||
|
inputName
|
||||||
|
"clan"
|
||||||
|
"modules"
|
||||||
|
moduleName
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
manifest = eval.config.manifest;
|
||||||
|
roles = lib.mapAttrs (_n: _v: { }) eval.config.roles;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modulesPerSource = lib.mkOption {
|
||||||
|
# { sourceName :: { moduleName :: {} }}
|
||||||
|
default =
|
||||||
|
let
|
||||||
|
inputsWithModules = lib.filterAttrs (_inputName: v: v ? clan.modules) flakeInputs;
|
||||||
|
|
||||||
|
in
|
||||||
|
lib.mapAttrs (
|
||||||
|
inputName: v: lib.mapAttrs (inspectModule inputName) v.clan.modules
|
||||||
|
) inputsWithModules;
|
||||||
|
};
|
||||||
|
options.localModules = lib.mkOption {
|
||||||
|
default = lib.mapAttrs (inspectModule "self") localModuleSet;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -255,7 +255,9 @@ in
|
|||||||
{
|
{
|
||||||
options.API = mkOption {
|
options.API = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
# This is read only, because we don't support turning it off yet
|
||||||
|
readOnly = true;
|
||||||
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
Enables automatic API schema conversion for the interface of this module.
|
Enables automatic API schema conversion for the interface of this module.
|
||||||
'';
|
'';
|
||||||
|
|||||||
Reference in New Issue
Block a user