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

forward test for example nix class -> hm and os

+56 -5
+1 -1
docs/src/content/docs/reference/batteries.mdx
··· 138 138 ## forward 139 139 140 140 Creates custom Nix classes by forwarding configs between classes. 141 - ([source](https://github.com/vic/den/blob/main/modules/aspects/provides/forward.nix) · [tests](https://github.com/vic/den/blob/main/templates/ci/modules/features/forward.nix) · [usage guide](/guides/custom-classes/)) 141 + ([source](https://github.com/vic/den/blob/main/modules/aspects/provides/forward.nix) · [tests](https://github.com/vic/den/blob/main/templates/ci/modules/features/forward-from-custom-class.nix) · [usage guide](/guides/custom-classes/)) 142 142 143 143 ```nix 144 144 den._.forward {
+1 -1
docs/src/content/docs/tutorials/ci.md
··· 102 102 |-----------|---------------| 103 103 | [angle-brackets.nix](https://github.com/vic/den/blob/main/templates/ci/modules/features/angle-brackets.nix) | All bracket resolution paths | 104 104 | [namespaces.nix](https://github.com/vic/den/blob/main/templates/ci/modules/features/namespaces.nix) | Local, remote, merged namespaces | 105 - | [forward.nix](https://github.com/vic/den/blob/main/templates/ci/modules/features/forward.nix) | Custom class forwarding | 105 + | [forward-from-custom-class.nix](https://github.com/vic/den/blob/main/templates/ci/modules/features/forward-from-custom-class.nix) | Custom class forwarding | 106 106 | [homes.nix](https://github.com/vic/den/blob/main/templates/ci/modules/features/homes.nix) | Standalone Home-Manager configs | 107 107 | [schema-base-modules.nix](https://github.com/vic/den/blob/main/templates/ci/modules/features/schema-base-modules.nix) | `den.base.{host,user,home,conf}` | 108 108
+6 -2
modules/aspects/provides/forward.nix
··· 33 33 See also: https://github.com/vic/den/issues/160, https://github.com/vic/flake-aspects/pull/31 34 34 ''; 35 35 36 - forward = 36 + forwardEach = fwd: { 37 + includes = map (item: forwardOne (fwd // { each = [ item ]; })) fwd.each; 38 + }; 39 + 40 + forwardOne = 37 41 { 38 42 guard ? null, 39 43 adaptArgs ? null, ··· 91 95 { 92 96 den.provides.forward = { 93 97 inherit description; 94 - __functor = _self: forward; 98 + __functor = _self: forwardEach; 95 99 }; 96 100 }
+48 -1
templates/ci/modules/features/forward-from-custom-class.nix
··· 1 1 { denTest, ... }: 2 2 { 3 - flake.tests.forward = { 3 + flake.tests.forward-custom-class = { 4 4 5 5 test-forward-custom-class-to-nixos = denTest ( 6 6 { ··· 111 111 112 112 expr = igloo.home-manager.users.tux.programs.git.userEmail; 113 113 expected = "root@linux.com"; 114 + } 115 + ); 116 + 117 + test-custom-nix-class-fowards-to-both-hm-and-nixos = denTest ( 118 + { 119 + den, 120 + lib, 121 + igloo, 122 + ... 123 + }: 124 + let 125 + forwarded = 126 + { class, aspect-chain }: 127 + den._.forward { 128 + each = [ 129 + "nixos" 130 + "homeManager" 131 + ]; 132 + fromClass = _: "nix"; 133 + intoClass = lib.id; 134 + intoPath = _: [ "nix" ]; 135 + fromAspect = _: lib.head aspect-chain; 136 + adaptArgs = 137 + { config, ... }: 138 + { 139 + osConfig = config; 140 + }; 141 + }; 142 + in 143 + { 144 + den.hosts.x86_64-linux.igloo.users.tux = { }; 145 + 146 + den.aspects.igloo.homeManager.home.stateVersion = "25.11"; 147 + 148 + den.aspects.tux = { 149 + includes = [ forwarded ]; 150 + nix.settings.allowed-users = [ "tux" ]; 151 + }; 152 + 153 + expr = { 154 + os = igloo.nix.settings.allowed-users; 155 + hm = igloo.home-manager.users.tux.nix.settings.allowed-users; 156 + }; 157 + expected = { 158 + os = [ "tux" ]; 159 + hm = [ "tux" ]; 160 + }; 114 161 } 115 162 ); 116 163