den

Dendrtic Pattern

English | 简体中文

The Dendritic pattern is a way to organize Nix configurations, where each Nix file is a flake-parts module. I use the Dendritic pattern to combine NixOS and Home Manager configurations, avoiding the issue where configuration items spanning two configuration systems are located in different places.

Module Architecture

Module Description
flake Modules related to flake-parts, including generating configuration from modules and some configuration items spanning NixOS and Home Manager
hosts NixOS and Home Manager modules for all managed hosts
core Core NixOS and Home Manager configuration modules
desktop Desktop environment NixOS and Home Manager configuration modules
dev Development environment NixOS and Home Manager configuration modules, assumed to be for desktop
services All NixOS modules running as services
users NixOS modules recording all users

Where to Start

Start with the flake module, specifically the module that generates outputs.nixosConfiguration. Then, check each host’s ./hosts/<hostname>/default.nix to see which modules are referenced, and finally review each module in turn.

Anything Else?

Of course! Here are some real-world Dendritic pattern NixOS configurations I have seen (listed alphabetically):