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

Update resolve documentation

+7 -8
+1 -1
docs/src/content/docs/explanation/aspects.mdx
··· 95 Aspects are resolved for a specific class using the `resolve` API from flake-aspects: 96 97 ```nix 98 - module = den.aspects.igloo.resolve { class = "nixos"; }; 99 ``` 100 101 Resolution collects all `nixos` attrs from owned configs, walks `includes`
··· 95 Aspects are resolved for a specific class using the `resolve` API from flake-aspects: 96 97 ```nix 98 + module = den.lib.aspects.resolve "nixos" [] den.aspects.igloo; 99 ``` 100 101 Resolution collects all `nixos` attrs from owned configs, walks `includes`
+1 -1
docs/src/content/docs/explanation/library-vs-framework.mdx
··· 51 52 # Resolve for your custom class 53 aspect = den.aspects.web-server { env = "production"; }; 54 - module = aspect.resolve { class = "terranix"; }; 55 ``` 56 57 ## Den as a Framework
··· 51 52 # Resolve for your custom class 53 aspect = den.aspects.web-server { env = "production"; }; 54 + module = den.lib.aspects.resolve "terranix" [] aspect; 55 ``` 56 57 ## Den as a Framework
+2 -2
docs/src/content/docs/guides/debug.md
··· 62 Test how an aspect resolves for a specific class: 63 64 ```console 65 - nix-repl> module = den.aspects.laptop.resolve { class = "nixos"; aspect-chain = []; } 66 nix-repl> config = (lib.evalModules { modules = [ module ]; }).config 67 ``` 68 ··· 70 71 ```console 72 nix-repl> aspect = den.aspects.laptop { host = den.hosts.x86_64-linux.laptop; } 73 - nix-repl> module = aspect.resolve { class = "nixos"; aspect-chain = []; } 74 ``` 75 76 ## Inspect a Host's Main Module
··· 62 Test how an aspect resolves for a specific class: 63 64 ```console 65 + nix-repl> module = den.lib.aspects.resolve "nixos" [] den.aspects.laptop; 66 nix-repl> config = (lib.evalModules { modules = [ module ]; }).config 67 ``` 68 ··· 70 71 ```console 72 nix-repl> aspect = den.aspects.laptop { host = den.hosts.x86_64-linux.laptop; } 73 + nix-repl> module = den.lib.aspects.resolve "nixos" [] aspect; 74 ``` 75 76 ## Inspect a Host's Main Module
+2 -2
docs/src/content/docs/index.mdx
··· 135 # Use Den API -- Context transformations happen here, nothing is configured yet. 136 aspect = den.ctx.host { host = den.hosts.x86_64-linux.igloo; }; 137 138 - # Use flake-aspects API -- We enter the NixOS domain by resolving for the "nixos" class. 139 - nixosModule = aspect.resolve { class = "nixos"; }; 140 141 # Use NixOS API -- Instantiate using nixosSystem with the resolved module. 142 nixosConfigurations.igloo = lib.nixosSystem { modules = [ nixosModule ]; };
··· 135 # Use Den API -- Context transformations happen here, nothing is configured yet. 136 aspect = den.ctx.host { host = den.hosts.x86_64-linux.igloo; }; 137 138 + # Use flake-aspects API (re-exported by Den) -- We enter the NixOS domain by resolving for the "nixos" class. 139 + nixosModule = den.lib.aspects.resolve "nixos" [] aspect; 140 141 # Use NixOS API -- Instantiate using nixosSystem with the resolved module. 142 nixosConfigurations.igloo = lib.nixosSystem { modules = [ nixosModule ]; };
+1 -1
templates/bogus/modules/test-base.nix
··· 59 funnyNames = 60 aspect: 61 let 62 - mod = aspect.resolve { class = "funny"; }; 63 namesMod = { 64 options.names = lib.mkOption { 65 type = lib.types.listOf lib.types.str;
··· 59 funnyNames = 60 aspect: 61 let 62 + mod = config.den.lib.aspects.resolve "funny" [ ] aspect; 63 namesMod = { 64 options.names = lib.mkOption { 65 type = lib.types.listOf lib.types.str;
-1
templates/microvm/modules/guests-example.nix
··· 23 }; 24 25 den.aspects.guest-microvm = { 26 - # resolved with: `(den.ctx.host = { host = guest-microvm }).resolve { class = "nixos" }` 27 # resulting nixos-module is set at server: microvm.vms.<name>.config 28 nixos = 29 { pkgs, ... }:
··· 23 }; 24 25 den.aspects.guest-microvm = { 26 # resulting nixos-module is set at server: microvm.vms.<name>.config 27 nixos = 28 { pkgs, ... }: