refactor(registry): add per-host uniqueness predicate
This commit is contained in:
@@ -2,10 +2,7 @@
|
|||||||
{
|
{
|
||||||
checks = [
|
checks = [
|
||||||
{
|
{
|
||||||
assertion = util.registry.predicates.uniqueValue (entry: {
|
assertion = util.registry.predicates.uniquePerHost (entry: entry.value.keys);
|
||||||
inherit (entry) host;
|
|
||||||
inherit (entry.value) keys;
|
|
||||||
});
|
|
||||||
message = "Desktop keybinds must use unique key chords per host.";
|
message = "Desktop keybinds must use unique key chords per host.";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -16,14 +16,23 @@ let
|
|||||||
[ ]
|
[ ]
|
||||||
) (builtins.readDir dir)
|
) (builtins.readDir dir)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
uniqueValue =
|
||||||
|
value: entries: builtins.length (lib.unique (map value entries)) == builtins.length entries;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit collectNixFiles;
|
inherit collectNixFiles;
|
||||||
|
|
||||||
removeNixSuffix = path: lib.removeSuffix ".nix" (builtins.baseNameOf path);
|
removeNixSuffix = path: lib.removeSuffix ".nix" (builtins.baseNameOf path);
|
||||||
|
|
||||||
registry.predicates.uniqueValue =
|
registry.predicates.uniqueValue = uniqueValue;
|
||||||
value: entries: builtins.length (lib.unique (map value entries)) == builtins.length entries;
|
|
||||||
|
registry.predicates.uniquePerHost =
|
||||||
|
value:
|
||||||
|
uniqueValue (entry: {
|
||||||
|
inherit (entry) host;
|
||||||
|
value = value entry;
|
||||||
|
});
|
||||||
|
|
||||||
bridgeName = id: "br-vlan${toString id}";
|
bridgeName = id: "br-vlan${toString id}";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user