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
1# __findFile implementation to resolve deep aspects.
2# inspired by https://fzakaria.com/2025/08/10/angle-brackets-in-a-nix-flake-world
3{
4 lib,
5 config,
6 ...
7}:
8_nixPath: name:
9let
10
11 findAspect =
12 path:
13 let
14 head = lib.head path;
15 tail = lib.tail path;
16
17 notFound = "Aspect not found: ${lib.concatStringsSep "." path}";
18
19 headIsDen = head == "den";
20 readFromDen = lib.getAttrFromPath ([ "den" ] ++ tail) config;
21
22 headIsAspect = builtins.hasAttr head config.den.aspects;
23 aspectsPath = [
24 "den"
25 "aspects"
26 ]
27 ++ path;
28 readFromAspects = lib.getAttrFromPath aspectsPath config;
29
30 headIsDenful = lib.hasAttrByPath [ "ful" head ] config.den;
31 denfulTail =
32 if builtins.length tail > 0 && lib.head tail == "provides" then lib.tail tail else tail;
33 denfulPath = [
34 "den"
35 "ful"
36 head
37 ]
38 ++ denfulTail;
39 readFromDenful = lib.getAttrFromPath denfulPath config;
40
41 found =
42 if headIsDen then
43 readFromDen
44 else if headIsAspect then
45 readFromAspects
46 else if headIsDenful then
47 readFromDenful
48 else
49 throw notFound;
50 in
51 found;
52
53in
54lib.pipe name [
55 (lib.strings.replaceStrings [ "/" ] [ ".provides." ])
56 (lib.strings.splitString ".")
57 findAspect
58]