Modular, context-aware and aspect-oriented dendritic Nix configurations.
Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/
den.oeiuwq.com
configurations
den
dendritic
nix
aspect
oriented
1{
2 inputs,
3 lib,
4 shared,
5 ...
6}:
7let
8 dataModule.nixos.options.data = lib.mkOption {
9 type = lib.types.listOf lib.types.str;
10 };
11 mkInputFlake = name: {
12 denful.shared.gaming._.retro._.sega = {
13 nixos.data = [ "${name}-sega-static" ];
14 };
15 };
16 inputFoo = mkInputFlake "foo";
17 inputBar = mkInputFlake "bar";
18in
19{
20 imports = [
21 (inputs.den.namespace "shared" [
22 true
23 inputFoo
24 inputBar
25 ])
26 ];
27
28 shared.gaming._.retro._.sega.nixos.data = [ "local-sega-static" ];
29
30 den.aspects.rockhopper.includes = [
31 dataModule
32 shared.gaming._.retro._.sega
33 ];
34
35 perSystem =
36 { checkCond, rockhopper, ... }:
37 let
38 vals = lib.sort (a: b: a < b) rockhopper.config.data;
39 in
40 {
41 checks.shared-parametric-all-merged = checkCond "all parametric merged" (
42 vals == [
43 "bar-sega-static"
44 "foo-sega-static"
45 "local-sega-static"
46 ]
47 );
48
49 checks.shared-flake-output-matches = checkCond "flake output matches" (
50 shared.gaming._.retro._.sega == inputs.self.denful.shared.gaming._.retro._.sega
51 );
52 };
53}