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
at main 28 lines 764 B view raw
1{ config, lib, ... }: 2let 3 inherit (config) den; 4 inherit (den.lib.aspects.types) aspectSubmodule; 5 inherit (den.lib) ctxApply; 6 7 # a context-definiton is an aspect extended with into.* transformations 8 # and a fixed functor to apply them. 9 ctxSubmodule = lib.types.submodule ( 10 { config, ... }: 11 { 12 imports = aspectSubmodule.getSubModules; 13 options.into = lib.mkOption { 14 description = "Context transformations to other context types"; 15 type = lib.types.lazyAttrsOf (lib.types.functionTo (lib.types.listOf lib.types.raw)); 16 default = { }; 17 }; 18 config.__functor = lib.mkForce ctxApply; 19 } 20 ); 21 22in 23{ 24 options.den.ctx = lib.mkOption { 25 default = { }; 26 type = lib.types.lazyAttrsOf ctxSubmodule; 27 }; 28}