dendritic-nix

Write and refactor NixOS and home-manager configuration using the dendritic flake-parts pattern.

Updated Jul 4, 2025
One-click install
npx skills add https://github.com/milespossing/nixdots --skill dendritic-nix-milespossing
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dendritic-nix
Source: https://github.com/milespossing/nixdots/tree/main/.agents/skills/dendritic-nix
Command: npx skills add https://github.com/milespossing/nixdots --skill dendritic-nix-milespossing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Managing NixOS and home-manager configuration across many files and hosts becomes tangled when files map to hosts or layers instead of features. This Skill encodes the dendritic pattern — flake-parts plus import-tree — so every file under modules/ is a flake-parts module that contributes one feature across nixos, home-manager, and darwin classes via flake.modules.<class>.<name>. ## Core Features & Use Cases - Feature-oriented modules: Each file owns one feature across all config classes, with auto-import via import-tree so adding a file is the only step needed to enable it. - Merged feature buckets: Contribute to shared buckets like flake.modules.nixos.base that deep-merge across files, avoiding per-file import lists and specialArgs plumbing. - Recipes and anti-patterns: Includes concrete recipes for nixos-only, home-manager-only, cross-cutting features, host definitions, overlays, and home-manager glue, plus a list of anti-patterns to avoid. - Use Case: When adding a new feature like audio or i3 to a NixOS dotfiles repo, create a single file under modules/ that sets both flake.modules.nixos and flake.modules.homeManager buckets, and hosts opt in by importing the bucket. ## Quick Start Ask the AI to add a new dendritic module for a feature, for example: create a modules/nixos/audio.nix that enables pipewire in the base nixos bucket following this repo's dendritic pattern.

Frequently Asked Questions about dendritic-nix

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new module in the dendritic Nix pattern?▼

Create a file under modules/ that sets flake.modules.<class>.<bucket>, such as flake.modules.nixos.base. import-tree auto-imports every file, so no imports list needs editing. Make the value a function like { pkgs, ... }: { ... } when you need NixOS or home-manager arguments.

What is the flake.modules option in flake-parts?▼

flake.modules is an option provided by flake-parts' flakeModules.modules, typed as lazyAttrsOf (lazyAttrsOf deferredModule). The outer key is a module class like nixos or homeManager, the inner key is a feature bucket name, and values merge across all files that target the same bucket.

How do I wire home-manager into NixOS with flake-parts?▼

Import inputs.home-manager.nixosModules.home-manager inside one glue module that sets flake.modules.nixos.home-manager. Then read config.flake.modules.homeManager.base in the flake-parts config and assign it to home-manager.users.<name>.imports, so hosts only import the home-manager bucket.

Can I use callPackage packages inside the dendritic import tree?▼

No, callPackage sources are not flake-parts modules and must stay outside the import tree, for example under pkgs/ at the repo root or any path containing /_. Wire them into configuration through a normal module that adds an overlay via nixpkgs.overlays.

Why should I avoid specialArgs in a dendritic Nix config?▼

Passing self or shared values through specialArgs and extraSpecialArgs creates plumbing the pattern eliminates. Instead, declare options on the top-level flake-parts config in bare per-domain namespaces like git.userEmail, and read them from any module file directly.

What are common anti-patterns in dendritic NixOS configs?▼

Common anti-patterns include giving every file its own unique bucket name, scattering raw flake.nixosModules instead of using flake.modules, making file paths behavior-significant, and adding enable flags for modules a host already imports. Merge non-distinct features into shared buckets like base or desktop.