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{ den, ... }:
2let
3 description = ''
4 An aspect that imports all modules defined for `from` class
5 into a target `into` submodule.
6
7 This can be used to create custom Nix classes that help
8 people separating concerns on huge module hierarchies.
9
10 For example, using a new `user` class that forwards all its
11 settings into `users.users.<userName>` allows:
12
13 den.aspects.alice.nixos.users.users.alice.isNormalUser = true;
14
15 to become:
16
17 den.aspects.alice.user.isNormalUser = true;
18
19
20 This is exactly how `homeManager` class support is implemented in Den.
21 See home-manager/hm-integration.nix.
22
23 Den also provides the mentioned `user` class (`den.provides.os-user`) for setting
24 NixOS/Darwin options under `users.users.<userName>` at os-level.
25
26 Any other user-environments like `nix-maid` or `hjem` or user-custom classes
27 are easily implemented using `den.provides.forward`.
28
29 Note: `den.provides.forward` returns an aspect that needs to be included for
30 the new class to exist.
31
32 See templates/ci/modules/guarded-forward.nix, templates/ci/modules/forward-from-custom-class.nix
33 See also: https://github.com/vic/den/issues/160
34 '';
35
36in
37{
38 den.provides.forward = {
39 inherit description;
40 __functor = _self: den.lib.forward.forwardEach;
41 };
42}