refactor(dotfiles): inline registry operations

This commit is contained in:
2026-09-30 09:49:55 -04:00
parent 2265dfc558
commit e49dcb67dc
2 changed files with 25 additions and 16 deletions

View File

@@ -5,21 +5,6 @@
validate,
}:
let
withOperations =
registry:
registry
// {
join = host: entry: join registry host entry;
};
join =
registry: host: entry:
lib.filterAttrs (_name: value: value != null) (
lib.mapAttrs (
registryName: _registry: (registry.${registryName}.${host} or { }).${entry} or null
) definitions
);
collectData =
let
data = lib.mapAttrs (
@@ -74,5 +59,16 @@ let
rawDeclarations =
registryName: lib.mapAttrs (_hostName: host: host.config.registry.${registryName} or { }) hosts;
join =
registry: host: entry:
lib.filterAttrs (_name: value: value != null) (
lib.mapAttrs (
registryName: _registry: (registry.${registryName}.${host} or { }).${entry} or null
) definitions
);
in
withOperations collectData
collectData
// {
join = host: entry: join collectData host entry;
}

View File

@@ -15,3 +15,16 @@ Do not apply this rule when a binding names a local constant used to keep siblin
Shared convenience bindings hide dependency direction.
Explicit references show which value owns a concept and which value consumes it.
## Do not use single-use merge wrappers
### Rule
Do not bind a local function that extends an attribute-set argument when it has one caller.
Merge the fields in the caller.
Keep the function when two or more callers use it.
### Rationale
Single-use wrappers hide construction of the result.
Direct merges show the added fields and their owner.