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
1{
2 mkFlake,
3 evalMod,
4 lib,
5 forward,
6 ...
7}:
8{
9 flake.tests.test-forward =
10 let
11 forwarded =
12 # deadnix: skip
13 { class, aspect-chain }:
14 forward {
15 each = [ "source" ];
16 fromClass = item: "${item}Class";
17 intoClass = _item: "targetClass";
18 intoPath = _item: [ "targetMod" ];
19 fromAspect = _item: lib.head aspect-chain;
20 };
21
22 targetSubmodule = {
23 options.targetMod = lib.mkOption {
24 type = lib.types.submodule {
25 options.names = lib.mkOption {
26 type = lib.types.listOf lib.types.str;
27 };
28 };
29 };
30 };
31
32 flake = mkFlake {
33 flake.aspects = {
34 fwd-self-target = {
35 targetClass = {
36 imports = [ targetSubmodule ];
37 targetMod.names = [ "from-target" ];
38 };
39
40 sourceClass.names = [ "from-source" ];
41
42 includes = [ forwarded ];
43 };
44 };
45 };
46
47 expr =
48 lib.sort (a: b: a < b)
49 (evalMod "targetClass" flake.modules.targetClass.fwd-self-target).targetMod.names;
50
51 expected = [
52 "from-source"
53 "from-target"
54 ];
55 in
56 {
57 inherit expr expected;
58 };
59
60}