|
Nest is a declarative framework for multi-node NixOS infrastructure. It applies the CSS mental model to system configuration: nodes are entities in a DOM tree, traits are classes, and rules map selectors to configuration. Full documentation: nest.denful.dev Example templates; Recommended read order: CI tests |
|
Infrastructure as a DOM. Your fleet lives in an attrset hierarchy that mirrors tree mental model — environments, roles, regions. Parents propagate scalar attributes to children, so you set system or env once at a subtree root and every node beneath inherits it.
Traits over repetition. Traits classify nodes and form dependency DAGs. Declaring a node as server can automatically pull in nginx, ssh, and firewall via needs. neededBy works in reverse — a monitoring trait can inject itself into every matching node without those nodes knowing it exists.
Rules over inheritance chains. Rules match nodes via selectors and contribute NixOS or other Dendritic Nix module fragments. Nest collects those fragments as a list and passes them directly to nixosSystem — the NixOS module system handles merging. This means lib.mkForce, lib.mkDefault, type checking, and conflict detection all work exactly as they do in hand-written configurations.
CSS selectors for targeting. The selection model composes: match by trait, by name, by attribute value, by DOM ancestry, by predicate, or any boolean combination. String-based CSS syntax (#lb-prod, .nixos, [env=prod], prod > web) is also supported for familiarity.
Synthesis for derived data. Allows computing derived node attributes and injecting virtual children. A host can synthesize data from its children or any other node in the DOM. Derived structure participates in rule matching like any other node.
