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.

docs: add "Aspect Fixed Point" section (#430)

Fix #341

authored by

Pol Dellaiera and committed by
GitHub
fa6a8c2d d7a0ac6a

+37 -6
+34 -3
docs/src/content/docs/guides/configure-aspects.mdx
··· 234 234 In case an aspect needs a custom submodule, it can be added this way: 235 235 236 236 ```nix 237 + # User aspect `tux` 237 238 den.aspects.tux = 238 239 { config, ... }: # The function-args style is required for `imports` not to be interpreted as an Aspect class. 239 240 { ··· 255 256 } 256 257 ``` 257 258 258 - And then, you can refer to this custom submodule from other aspects: 259 + And then, you can refer to `tux` aspect from other aspects: 259 260 260 261 ```nix 261 262 { den, ... }: ··· 267 268 programs = { 268 269 gpg = { 269 270 enable = true; 270 - settings.default-key = den.aspects.${config.home.username}.default-key; 271 + settings.default-key = den.aspects.tux.default-key; # Access the `tux` aspect statically 271 272 }; 272 273 }; 273 274 ··· 276 277 enable = true; 277 278 enableSshSupport = true; 278 279 sshKeys = [ 279 - den.aspects.${config.home.username}.keygrip 280 + den.aspects.${config.home.username}.keygrip # Access the current user aspect dynamically 280 281 ]; 281 282 }; 282 283 }; ··· 284 285 }; 285 286 } 286 287 ``` 288 + 289 + ## Aspect Fixed-Point 290 + 291 + Aspects are fixed-point, meaning that they can reference themselves, as such: 292 + 293 + ```nix 294 + { 295 + den.aspects.igloo = 296 + {config,...}: # Here, `config` represents the aspect `igloo` itself. 297 + { 298 + meta = { 299 + default-key = "Hello World!"; 300 + }; 301 + 302 + homeManager = { 303 + programs = { 304 + gpg = { 305 + enable = true; 306 + settings.default-key = config.meta.default-key; 307 + }; 308 + 309 + git = { 310 + enable = true; 311 + settings.signing.key = config.meta.default-key; 312 + } 313 + }; 314 + }; 315 + }; 316 + } 317 + ```
+3 -3
docs/src/content/docs/guides/mutual.mdx
··· 20 20 21 21 ## Default, *unidirectional* OS configuration 22 22 23 - Den framework is built around **context pipeline** transformations. 23 + Den framework is built around **context pipeline** transformations. 24 24 In order to create a full OS configuration, everything starts with a host definition: 25 25 26 26 ```nix "igloo" "tux" ··· 28 28 ``` 29 29 30 30 We need to build the `nixos` Nix module that will later be used by `lib.nixosSystem`. 31 - To do so, Den invokes the `den.ctx.host` pipeline like this: 31 + To do so, Den invokes the `den.ctx.host` pipeline like this: 32 32 33 33 > `Tip: Zoom diagrams using your mouse wheel or drag to move.` 34 34 ··· 64 64 65 65 ## `den.provides.mutual-provider` 66 66 67 - The [`den.provides.mutual-provider`](https://github.com/vic/den/blob/main/modules/aspects/provides/mutual-provider.nix) battery allows you to define mutual congigurations by letting you to define named aspects under `.provides.` to create explicit relationship between users and hosts. 67 + The [`den.provides.mutual-provider`](https://github.com/vic/den/blob/main/modules/aspects/provides/mutual-provider.nix) battery allows you to define mutual configurations by letting you to define named aspects under `.provides.` to create explicit relationship between users and hosts. 68 68 69 69 ```nix 70 70 # mutual-provider is activated at a `{host,user}` context