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 36 lines 1.3 kB view raw
1{ den, lib, ... }: 2let 3 inherit (den.lib) take; 4 inherit (den.lib.parametric) fixedTo atLeast; 5 6 ctx.user.description = '' 7 ## Context: den.ctx.user{host,user} 8 9 User context stage is produced by Host for each user. 10 11 This is a **continuation** of the pipeline started by `den.ctx.host`. 12 13 IMPORTANT: The configuration obtained from `den.ctx.user` is provided to the Host OS level 14 15 In Den, home-manager/hjem/maid are just forwarding classes that produce config at the OS 16 level: `home-manager.users.<alice>`, `hjem.users.<alice>`, `users.users.<alice>`, etc. 17 18 A `den.ctx.user{host,user}` transitions unconditionally into `den.ctx.default{host,user}` 19 20 A `den.ctx.user{host,user}` obtains OS configuration nixos/darwin by using `fixedTo{host,user} user-aspect`. 21 fixedTo takes: 22 - user-aspect's owned attrs 23 - static includes like { nixos.foo = ... } or ({ class, aspect-chain }: { nixos.foo = ...; }) 24 - atLeast{host,user} parametric includes like ({ host,user }: { nixos.foo = ...; }) 25 26 ''; 27 28 ctx.user.into.default = lib.singleton; 29 ctx.user.provides.user = take.exactly from-user; 30 31 from-user = { host, user }: fixedTo { inherit host user; } den.aspects.${user.aspect}; 32 33in 34{ 35 den.ctx = ctx; 36}