From e49dcb67dc6ffa867b30c08d1796a5083c9e9842 Mon Sep 17 00:00:00 2001 From: alexion Date: Wed, 30 Sep 2026 09:49:55 -0400 Subject: [PATCH 1/3] refactor(dotfiles): inline registry operations --- src/dotfiles/registry/collection.nix | 28 ++++++++++++---------------- src/skills/style/nix/rules/let.md | 13 +++++++++++++ 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/dotfiles/registry/collection.nix b/src/dotfiles/registry/collection.nix index b5de52d..83d08b7 100644 --- a/src/dotfiles/registry/collection.nix +++ b/src/dotfiles/registry/collection.nix @@ -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; +} diff --git a/src/skills/style/nix/rules/let.md b/src/skills/style/nix/rules/let.md index 7a3d576..222e06a 100644 --- a/src/skills/style/nix/rules/let.md +++ b/src/skills/style/nix/rules/let.md @@ -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. -- 2.47.3 From 8fa11b85fdc100e7a9217bfdd25ca4912c255fcc Mon Sep 17 00:00:00 2001 From: alexion Date: Wed, 30 Sep 2026 09:51:28 -0400 Subject: [PATCH 2/3] refactor(dotfiles): inline registry join --- src/dotfiles/registry/collection.nix | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/dotfiles/registry/collection.nix b/src/dotfiles/registry/collection.nix index 83d08b7..14d6a67 100644 --- a/src/dotfiles/registry/collection.nix +++ b/src/dotfiles/registry/collection.nix @@ -59,16 +59,14 @@ 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 collectData // { - join = host: entry: join collectData host entry; + join = + host: entry: + lib.filterAttrs (_name: value: value != null) ( + lib.mapAttrs ( + registryName: _registry: (collectData.${registryName}.${host} or { }).${entry} or null + ) definitions + ); } -- 2.47.3 From c22c6d30390da92be52a4961dcb0bbd27ff37daa Mon Sep 17 00:00:00 2001 From: alexion Date: Wed, 30 Sep 2026 09:55:52 -0400 Subject: [PATCH 3/3] Revert "refactor(dotfiles): inline registry join" This reverts commit 8fa11b85fdc100e7a9217bfdd25ca4912c255fcc. --- src/dotfiles/registry/collection.nix | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/dotfiles/registry/collection.nix b/src/dotfiles/registry/collection.nix index 14d6a67..83d08b7 100644 --- a/src/dotfiles/registry/collection.nix +++ b/src/dotfiles/registry/collection.nix @@ -59,14 +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 collectData // { - join = - host: entry: - lib.filterAttrs (_name: value: value != null) ( - lib.mapAttrs ( - registryName: _registry: (collectData.${registryName}.${host} or { }).${entry} or null - ) definitions - ); + join = host: entry: join collectData host entry; } -- 2.47.3