Merge pull request 'Inventory/constraints improve observability' (#2400) from hsjobeki/clan-core:hsjobeki-main into main

This commit is contained in:
clan-bot
2024-11-13 13:42:17 +00:00
13 changed files with 297 additions and 235 deletions

View File

@@ -3,7 +3,7 @@
imports = [
./backups.nix
./facts
./inventory/interface.nix
./inventory
./manual.nix
./meta/interface.nix
./metadata.nix

View File

@@ -0,0 +1,6 @@
{
imports = [
./interface.nix
./implementation.nix
];
}

View File

@@ -0,0 +1,6 @@
{ config, ... }:
{
config.assertions = builtins.attrValues (
builtins.mapAttrs (_id: value: value // { inherit _id; }) config.clan.inventory.assertions
);
}

View File

@@ -60,4 +60,22 @@ in
'';
type = lib.types.attrsOf (lib.types.attrsOf instanceOptions);
};
options.clan.inventory.assertions = lib.mkOption {
default = { };
internal = true;
visible = false;
type = lib.types.attrsOf (
# TODO: use NixOS upstream type
lib.types.submodule {
options = {
assertion = lib.mkOption {
type = lib.types.bool;
};
message = lib.mkOption {
type = lib.types.str;
};
};
}
);
};
}