fake.modules transposition for aspect-oriented Dendritic Nix. with cross-aspect dependencies. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/ dendrix.oeiuwq.com/Dendritic.html
dendritic nix aspect oriented
at main 43 lines 1.0 kB view raw
1{ lib, new-scope, ... }: 2{ 3 4 flake.tests."test usage without flakes" = 5 let 6 # first eval is like evaling the flake. 7 first = lib.evalModules { 8 modules = [ 9 (new-scope "hello") 10 { 11 hello.aspects = 12 { aspects, ... }: 13 { 14 a.b.c = [ "world" ]; 15 a.includes = [ aspects.x ]; 16 x.b = 17 { lib, ... }: 18 { 19 c = lib.splitString " " "mundo cruel"; 20 }; 21 }; 22 } 23 ]; 24 }; 25 # second eval is like evaling its nixosConfiguration 26 second = lib.evalModules { 27 modules = [ 28 { options.c = lib.mkOption { type = lib.types.listOf lib.types.str; }; } 29 first.config.hello.modules.b.a 30 ]; 31 }; 32 expr = lib.sort (a: b: a < b) second.config.c; 33 expected = [ 34 "cruel" 35 "mundo" 36 "world" 37 ]; 38 in 39 { 40 inherit expr expected; 41 }; 42 43}