51 lines
1.1 KiB
Nix
51 lines
1.1 KiB
Nix
{
|
|
hosts,
|
|
lib,
|
|
root,
|
|
util,
|
|
}:
|
|
let
|
|
definitions = lib.genAttrs' (util.collectNixFiles root) (
|
|
path: lib.nameValuePair (util.removeNixSuffix path) (mkRegistry path)
|
|
);
|
|
|
|
# NOLINT(single_use_binding)
|
|
mkRegistry =
|
|
path:
|
|
let
|
|
evaluated = lib.evalModules {
|
|
specialArgs = { inherit util; };
|
|
modules = [
|
|
(import ./registry/schema.nix { inherit lib; })
|
|
path
|
|
];
|
|
};
|
|
in
|
|
{
|
|
inherit (evaluated.config) type replicate checks;
|
|
};
|
|
|
|
in
|
|
{
|
|
types = lib.mapAttrs (_name: definition: definition.type) definitions;
|
|
|
|
module = {
|
|
options.registry = lib.mapAttrs (
|
|
_name: registry:
|
|
lib.mkOption {
|
|
type = lib.types.attrsOf (lib.types.attrsOf registry.type);
|
|
default = { };
|
|
description = ''
|
|
Stores registry entries that the collector exposes to the fleet.
|
|
Nests entries by host and entry name.
|
|
'';
|
|
}
|
|
) definitions;
|
|
};
|
|
|
|
collected = import ./registry/collection.nix {
|
|
inherit definitions hosts lib;
|
|
validate = import ./registry/validation.nix { inherit definitions lib; };
|
|
};
|
|
}
|