nix-flake-organization
Installation
SKILL.md
Nix flake organization
Keep flake/ as the public output layer and src/ as the implementation layer. The flake tree names, routes, and re-exports outputs; feature behavior, module bodies, package derivations, app scripts, and helper logic live under src/<name>/....
Apply codebase-design within those boundaries:
keep each feature's implementation together and extract only to hide complexity
or enable useful reuse. Nix output adapters are meaningful public entrypoints;
additional internal forwarding files need their own purpose. Preserve Nix's
roles rather than imposing TypeScript models/ and services/ directories.
When to use
- A user asks to reorganize or refactor a Nix flake layout.
- Flake outputs are crowded into
flake.nixor mixed with implementation code. - NixOS, nix-darwin, Home Manager, or flake-parts modules contain business logic directly in output wiring files.
- A repo needs a clear split between public flake API and implementation internals.