Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Linting & Formatting

Nine hooks run on every commit once the dev shell has installed them, and the pre-commit-check flake check runs the same set in CI. Both are built from the two hook sets named in flake/checks/default.nix.

Hooks

HookPurposeHook stageRun by hand
treefmtFormats Nix (Alejandra), shell (shfmt), TOML (taplo), YAML (yamlfmt) and Markdown (mdformat)pre-commitjust fmt
StatixNix linter (anti-patterns)pre-commitjust lint
DeadnixDead code detectorpre-commitjust lint
commitizenConventional commit message validationcommit-msgcz check
gitleaksScans what the commit stages for keys and tokenspre-commit
comment-hygieneFile headers, banner comments, anchors, and docs pages and linkspre-commit
contract-mirrorKeeps the consumer contract in CONTRIBUTING.md and AGENTS.md identicalpre-commit
contract-guardsEnforces the consumer contract against modules/pre-commit
hygiene-scanRefuses staged text that names private infrastructure, such as an SSH flake URL or a tailnet addresspre-commithygiene-scan FILE

The first five suit any Nix repository, and devShells.consumer installs those alone. The last four read this repository’s own tree, so only devShells.default installs them.

Alejandra is not a hook of its own. It runs as one of the treefmt formatters, which are configured in flake/treefmt.nix. mdformat skips docs/ and CHANGELOG.md.

secret-scan is a separate flake check that runs gitleaks over every tracked file, where the hook sees only what one commit stages.

Commit Messages

commitizen enforces the Conventional Commits format.

type(scope): description

# Examples:
feat: add ashell status bar module
fix: resolve GPU adapter failure with Vulkan backend
chore: update flake inputs
docs: add keybindings reference

Valid types: feat, fix, chore, docs, style, refactor, perf, test, build, ci, revert.

Hooks are built in flake/dev-shells.nix with git-hooks.nix and installed when entering the dev shell (nix develop).

Manual Checks

# Format the repository
just fmt

# Format check, statix and deadnix
just lint

# lint plus nix flake check
just ci

just lint runs statix and deadnix from the dev shell. nix run nixpkgs#statix resolves through the flake registry and not through flake.lock, so it can run a different version than CI and the hook do.

Fixing Issues

  • Formatting: just fmt auto-fixes all formatting
  • Statix: Read the suggestions and apply them by hand, or run nix develop -c statix fix .
  • Deadnix: Remove unused variables/arguments flagged by deadnix