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

allow providers to be static aspects (#9)

authored by oeiuwq.com and committed by

GitHub 0fb045fa a58df91d

+5 -3
+1 -1
README.md
··· 186 186 187 187 When a module like `flake.modules.nixos.foo` is requested (for example, included in a `nixosConfiguration`), a corresponding module is computed from `flake.aspects.foo.nixos`. 188 188 189 - `flake.aspects.foo.includes` is a list of functions (providers). A **provider** is a function `{ class, aspect-chain } => <aspect-object>`. They are called with `{ aspect-chain = [ aspects.foo ]; class = "nixos" }`, functions can inspect the chain of aspects that have led to the call. These providers return an aspect object that contains a module of the same `class` (in this case, `nixos`). 189 + `flake.aspects.foo.includes` is a list of functions (providers). A **provider** is either a constant `<aspect-object>` or a function `{ class, aspect-chain } => <aspect-object>`. They are called with `{ aspect-chain = [ aspects.foo ]; class = "nixos" }`, functions can inspect the chain of aspects that have led to the call. These providers return an aspect object that contains a module of the same `class` (in this case, `nixos`). Providers allow us to have a tree of aspects where each provided aspect can be either static or parametric. 190 190 191 191 Providers answer the question: given we have `nixos` modules from `[foo]` aspects, what other aspects can provide `nixos` modules that need to be imported? 192 192
+2 -1
checkmate.nix
··· 167 167 classOne.bar = [ "two:${class}:${lib.concatStringsSep "/" (lib.map (x: x.name) aspect-chain)}" ]; 168 168 classTwo.bar = [ "foo class two not included" ]; 169 169 }; 170 - provides.bar = _: { 170 + # a provider can be immediately an aspect object. 171 + provides.bar = { 171 172 # classOne is missing on bar 172 173 classTwo.bar = [ "bar class two not included" ]; 173 174 };
+2 -1
nix/types.nix
··· 26 26 isEmpty || classOnly || chainOnly || both 27 27 ); 28 28 29 - providerType = lib.types.either functionToAspect (lib.types.functionTo providerType); 29 + functionProviderType = lib.types.either functionToAspect (lib.types.functionTo providerType); 30 + providerType = lib.types.either functionProviderType aspectSubmodule; 30 31 31 32 aspectSubmodule = lib.types.submodule ( 32 33 {