refactor(dotfiles): inline registry operations
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user