Import all nix files in a directory tree. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/ dendrix.oeiuwq.com/Dendritic.html
dendritic inputs

just remembered functions do exist. (#18)

authored by oeiuwq.com and committed by

GitHub 234b5bb6 6d319ab4

+12 -10
+12 -10
default.nix
··· 99 99 let 100 100 __config = (f self); 101 101 boundAPI = builtins.mapAttrs (_: g: g (self f)) __config.api; 102 + accAttr = attrName: acc: self (c: mapAttr (f c) attrName acc); 103 + mergeAttrs = attrs: self (c: (f c) // attrs); 102 104 in 103 105 boundAPI 104 106 // { ··· 106 108 __functor = functor; 107 109 108 110 # Configuration updates (accumulating) 109 - filter = filterf: self (c: mapAttr (f c) "filterf" (and filterf)); 110 - filterNot = filterf: self (c: mapAttr (f c) "filterf" (andNot filterf)); 111 - match = regex: self (c: mapAttr (f c) "filterf" (and (matchesRegex regex))); 112 - matchNot = regex: self (c: mapAttr (f c) "filterf" (andNot (matchesRegex regex))); 113 - map = mapf: self (c: mapAttr (f c) "mapf" (compose mapf)); 114 - addPath = path: self (c: mapAttr (f c) "paths" (p: p ++ [ path ])); 115 - addAPI = api: self (c: mapAttr (f c) "api" (a: a // api)); 111 + filter = filterf: accAttr "filterf" (and filterf); 112 + filterNot = filterf: accAttr "filterf" (andNot filterf); 113 + match = regex: accAttr "filterf" (and (matchesRegex regex)); 114 + matchNot = regex: accAttr "filterf" (andNot (matchesRegex regex)); 115 + map = mapf: accAttr "mapf" (compose mapf); 116 + addPath = path: accAttr "paths" (p: p ++ [ path ]); 117 + addAPI = api: accAttr "api" (a: a // api); 116 118 117 119 # Configuration updates (non-accumulating) 118 - withLib = lib: self (c: (f c) // { inherit lib; }); 119 - pipeTo = pipef: self (c: (f c) // { inherit pipef; }); 120 - leafs = self (c: (f c) // { pipef = (i: i); }); 120 + withLib = lib: mergeAttrs { inherit lib; }; 121 + pipeTo = pipef: mergeAttrs { inherit pipef; }; 122 + leafs = mergeAttrs { pipef = (i: i); }; 121 123 122 124 # Applies empty (for already path-configured trees) 123 125 result = (self f) [ ];