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{ lib, ... }:
2let
3 # A custom `nixos` class module that defines an option `names`.
4 # Used to test that we are not duplicating values from owned configs.
5 nixosNames = names: { options.${names} = lib.mkOption { type = lib.types.listOf lib.types.str; }; };
6in
7{
8 den.default.nixos.imports = [ (nixosNames "people") ];
9 den.default.includes = [
10 (
11 { user, ... }:
12 {
13 nixos.people = [ user.name ];
14 }
15 )
16 ];
17
18 den.aspects.rockhopper.includes = [
19 # Example: importing a third-party nixos module.
20 { nixos.imports = [ (nixosNames "names") ]; }
21 ];
22
23 den.aspects.rockhopper.nixos.names = [ "tux" ];
24
25 perSystem =
26 { checkCond, rockhopper, ... }:
27 {
28 checks.rockhopper-default-people = checkCond "set from den.default for each user" (
29 rockhopper.config.people == [ "alice" ]
30 );
31 checks.rockhopper-names-single-entry = checkCond "custom nixos array option set once" (
32 rockhopper.config.names == [ "tux" ]
33 );
34 };
35}