Modular, context-aware and aspect-oriented dendritic Nix configurations. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/ den.oeiuwq.com
configurations den dendritic nix aspect oriented
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: resolve host-aspects for homeManager class only (#467)

## Summary
- `host-aspects` battery was including the raw `host.aspect` tree via
`fixedTo`, which caused host nixos modules to be collected again when
the user context contributed to the host's resolution
- Now resolves `host.aspect` specifically for class `"homeManager"` and
emits only a homeManager module, preventing nixos/darwin duplication

## Test plan
- [x] All existing host-aspects tests pass (6/6)
- [x] New `test-no-nixos-duplication`: verifies host nixos tags appear
exactly once, not duplicated
- [x] Full CI passes (499/499)

authored by

Jason Bowman and committed by
GitHub
f002e70b b28ae086

+56 -3
+15 -3
modules/aspects/provides/host-aspects.nix
··· 12 12 13 13 Any host aspect that defines a `homeManager` key will have that 14 14 config forwarded to the user's homeManager evaluation. Other class 15 - keys (nixos, darwin) are ignored — the pipeline resolves with 16 - class = "homeManager" so only homeManager modules are collected. 15 + keys (nixos, darwin) are ignored — host.aspect is resolved 16 + specifically for class "homeManager", so only homeManager modules 17 + are collected. This avoids duplicating nixos modules that are 18 + already applied via the host's own resolution. 17 19 ''; 18 20 19 - from-host = { host, user }: parametric.fixedTo { inherit host user; } host.aspect; 21 + # Resolve host.aspect for homeManager class only, producing a single 22 + # homeManager module. This prevents nixos/darwin class keys from 23 + # being collected again when the user context contributes to the 24 + # host's resolution. 25 + from-host = 26 + { host, user }: 27 + { 28 + homeManager = den.lib.aspects.resolve "homeManager" ( 29 + parametric.fixedTo { inherit host user; } host.aspect 30 + ); 31 + }; 20 32 21 33 in 22 34 {
+41
templates/ci/modules/features/host-aspects.nix
··· 97 97 } 98 98 ); 99 99 100 + # Host nixos modules are NOT duplicated when user includes host-aspects. 101 + # Uses a listOf option to detect double-application. 102 + test-no-nixos-duplication = denTest ( 103 + { 104 + den, 105 + lib, 106 + igloo, 107 + tuxHm, 108 + ... 109 + }: 110 + { 111 + den.hosts.x86_64-linux.igloo.users.tux = { }; 112 + 113 + den.default.nixos.imports = [ 114 + { 115 + options.tags = lib.mkOption { 116 + type = lib.types.listOf lib.types.str; 117 + default = [ ]; 118 + }; 119 + } 120 + ]; 121 + 122 + den.aspects.igloo = { 123 + nixos.tags = [ "host" ]; 124 + homeManager.programs.vim.enable = true; 125 + }; 126 + 127 + den.aspects.tux.includes = [ den._.host-aspects ]; 128 + 129 + expr = { 130 + tags = igloo.tags; 131 + vim = tuxHm.programs.vim.enable; 132 + }; 133 + expected = { 134 + # "host" should appear exactly once — not duplicated 135 + tags = [ "host" ]; 136 + vim = true; 137 + }; 138 + } 139 + ); 140 + 100 141 # User who does NOT include den._.host-aspects does not receive host homeManager. 101 142 test-opt-in-only = denTest ( 102 143 {