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
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

move nix files. test default provider override.

+46 -10
+5 -5
README.md
··· 13 13 14 14 However, for many users, a transposed attribute set, `<aspect>.<class>`, can be more intuitive. It often feels more natural to nest classes within aspects rather than the other way around. 15 15 16 - This project provides a small, dependency-free [`transpose`](default.nix) primitive that is powerful enough to implement [cross-aspect dependencies](aspects.nix) for any Nix configuration class. It also includes a [flake-parts module](flakeModule.nix) that transforms `flake.aspects` into `flake.modules`. 16 + This project provides a small, dependency-free [`transpose`](nix/default.nix) primitive that is powerful enough to implement [cross-aspect dependencies](nix/aspects.nix) for any Nix configuration class. It also includes a [flake-parts module](nix/flakeModule.nix) that transforms `flake.aspects` into `flake.modules`. 17 17 18 18 <table> 19 19 <tr> ··· 75 75 76 76 ## Usage 77 77 78 - ### As a Dependency-Free Library (`./default.nix`) 78 + ### As a Dependency-Free Library (`./nix/default.nix`) 79 79 80 - The [`transpose`](default.nix) library accepts an optional `emit` function that can be used to ignore items, modify them, or generate multiple items from a single input. 80 + The [`transpose`](nix/default.nix) library accepts an optional `emit` function that can be used to ignore items, modify them, or generate multiple items from a single input. 81 81 82 82 ```nix 83 - let transpose = import ./default.nix { lib = pkgs.lib; }; in 83 + let transpose = import ./nix/default.nix { lib = pkgs.lib; }; in 84 84 transpose { a.b.c = 1; } # => { b.a.c = 1; } 85 85 ``` 86 86 87 - This `emit` function is utilized by the [`aspects`](aspects.nix) library (both libraries are independent of flakes) to manage cross-aspect, same-class module dependencies. 87 + This `emit` function is utilized by the [`aspects`](nix/aspects.nix) library (both libraries are independent of flakes) to manage cross-aspect, same-class module dependencies. 88 88 89 89 ### As a Dendritic Flake-Parts Module (`flake.aspects` option) 90 90
aspects.nix nix/aspects.nix
+39 -3
checkmate.nix
··· 3 3 perSystem = 4 4 { lib, ... }: 5 5 let 6 - transpose = import ./. { inherit lib; }; 6 + transpose = import ./nix { inherit lib; }; 7 7 8 8 mkFlake = 9 9 mod: ··· 14 14 { 15 15 systems = [ ]; 16 16 imports = [ 17 - ./flakeModule.nix 17 + ./nix/flakeModule.nix 18 18 inputs.flake-parts.flakeModules.modules 19 19 mod 20 20 (fooMod "aspectOne") ··· 84 84 { 85 85 systems = [ ]; 86 86 imports = [ 87 - ./flakeModule.nix 87 + ./nix/flakeModule.nix 88 88 inputs.flake-parts.flakeModules.modules 89 89 ]; 90 90 }; ··· 263 263 expected = [ 264 264 "1" 265 265 "mundo" 266 + ]; 267 + in 268 + { 269 + inherit expr expected; 270 + }; 271 + 272 + aspects."test override default provider" = 273 + let 274 + flake = mkFlake { 275 + flake.aspects = 276 + { aspects, ... }: 277 + { 278 + aspectOne.includes = [ (aspects.aspectTwo "hello") ]; 279 + aspectOne.classOne = { }; # required for propagation 280 + 281 + aspectTwo.__functor = 282 + _: message: 283 + { class, aspect-chain }: 284 + { aspect, ... }: 285 + { 286 + classOne.bar = [ 287 + aspect.name 288 + message 289 + class 290 + ] ++ aspect-chain; 291 + }; 292 + aspectTwo.classOne.bar = [ "itself not included" ]; 293 + }; 294 + }; 295 + 296 + expr = (evalMod "classOne" flake.modules.classOne.aspectOne).bar; 297 + expected = [ 298 + "<function body>" 299 + "hello" 300 + "classOne" 301 + "aspectOne" 266 302 ]; 267 303 in 268 304 {
default.nix nix/default.nix
+2 -2
flake.nix
··· 1 1 { 2 2 outputs = _: { 3 - __functor = _: import ./.; 4 - flakeModule = ./flakeModule.nix; 3 + __functor = _: import ./nix; 4 + flakeModule = ./nix/flakeModule.nix; 5 5 }; 6 6 }
flakeModule.nix nix/flakeModule.nix
types.nix nix/types.nix