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

nix class example by @musjj

+26 -11
+26 -11
docs/src/content/docs/guides/custom-classes.mdx
··· 18 18 `den._.forward` creates an aspect that takes configs from a source class 19 19 and inserts them into a target class at a specified path. 20 20 21 - ## Example: How Den forwards `hjem` user class to NixOS 21 + ### Example: How Den forwards `hjem` user class to NixOS 22 22 23 23 Den already integrates nix-maid and hjem just like home-manager. 24 24 ··· 45 45 } 46 46 ``` 47 47 48 - Example: A git class that forwards to home-manager. 48 + ### Example: A git class that forwards to home-manager. 49 49 50 50 ```nix 51 51 gitClass = ··· 54 54 each = lib.singleton true; 55 55 fromClass = _: "git"; 56 56 intoClass = _: "homeManager"; 57 - intoPath = _: [ 58 - "programs" 59 - "git" 60 - ]; 57 + intoPath = _: [ "programs" "git" ]; 61 58 fromAspect = _: lib.head aspect-chain; 62 - adaptArgs = 63 - { config, ... }: 64 - { 65 - osConfig = config; 66 - }; 59 + adaptArgs = lib.id; 67 60 }; 68 61 69 62 den.aspects.tux = { ··· 74 67 75 68 This will set at host: `igloo.home-manager.users.tux.programs.git.userEmail` 76 69 70 + ### Example: A `nix` class that propagates settings to NixOS and HomeManager 71 + 72 + > Contributed by @musjj 73 + 74 + ```nix 75 + nixClass = 76 + { class, aspect-chain }: 77 + den._.forward { 78 + each = [ "nixos" "homeManager" ]; 79 + fromClass = _: "nix"; 80 + intoClass = lib.id; 81 + intoPath = _: [ "nix" "settings" ]; 82 + fromAspect = _: lib.head aspect-chain; 83 + adaptArgs = lib.id; 84 + }; 85 + 86 + nix-allowed = { user, ... }: { 87 + nix.allowed-users = [ user.userName ]; 88 + }; 89 + 90 + den.aspects.tux.includes = [ nixClass nix-allowed ]; 91 + ``` 77 92 78 93 ## Use Cases 79 94