flake.nix in a Dendritic NixOS Setup

flake.nix is the root entry point. In this architecture, it is deliberately small: it names external inputs, then asks flake-parts and import-tree to assemble the real configuration from cells/.

Up: NixOS Flakes Dendritic System Setup

Down: cells | dev shell

What this node does

The flake root has two jobs.

  • It pins upstream inputs such as nixpkgs, home-manager, impermanence, sops-nix, hardware modules, desktop inputs, and overlays.
  • It delegates output construction to imported cell files instead of keeping all systems in one large expression.

Why it is set up this way

A monolithic flake becomes difficult to review because unrelated concerns sit next to each other. This setup keeps the root stable and pushes detail outward into named cells.

That makes the root feel like a trunk. It does not know every leaf. It only knows how the tree is imported.

Code walkthrough

The architectural line is the output expression.

outputs = inputs:
  inputs.flake-parts.lib.mkFlake { inherit inputs; }
    (inputs.import-tree ./cells);

mkFlake gives the repository a structured output model. import-tree ./cells discovers the files that define options, branches, hosts, overlays, checks, and dev shells.

Inputs that point to private local paths should be documented with placeholders rather than copied verbatim.

inputs = {
  nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  home-manager.inputs.nixpkgs.follows = "nixpkgs";
  sops-nix.inputs.nixpkgs.follows = "nixpkgs";
  nix-secrets = {
    url = "git+file:///path/to/private/secrets";
    flake = false;
  };
};

What to copy

Use the root flake to declare sources of truth, not host behavior. Put reusable behavior in cells, then let hosts select it through branch names.