Inventory/assertions: add seperate assertion layer
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
imports = [
|
imports = [
|
||||||
./backups.nix
|
./backups.nix
|
||||||
./facts
|
./facts
|
||||||
./inventory/interface.nix
|
./inventory
|
||||||
./manual.nix
|
./manual.nix
|
||||||
./meta/interface.nix
|
./meta/interface.nix
|
||||||
./metadata.nix
|
./metadata.nix
|
||||||
|
|||||||
6
nixosModules/clanCore/inventory/default.nix
Normal file
6
nixosModules/clanCore/inventory/default.nix
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./interface.nix
|
||||||
|
./implementation.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
6
nixosModules/clanCore/inventory/implementation.nix
Normal file
6
nixosModules/clanCore/inventory/implementation.nix
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
config.assertions = builtins.attrValues (
|
||||||
|
builtins.mapAttrs (_id: value: value // { inherit _id; }) config.clan.inventory.assertions
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -60,4 +60,21 @@ in
|
|||||||
'';
|
'';
|
||||||
type = lib.types.attrsOf (lib.types.attrsOf instanceOptions);
|
type = lib.types.attrsOf (lib.types.attrsOf instanceOptions);
|
||||||
};
|
};
|
||||||
|
options.clan.inventory.assertions = lib.mkOption {
|
||||||
|
default = { };
|
||||||
|
internal = true;
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user