nix-playgraound/notes/019-formatter-and-checks.md
Hassan Abedi c7b7f2fdd4 WIP
2026-04-24 12:46:19 +02:00

854 B

Formatter and Checks

This note covers 16-formatter-and-checks/, which exposes formatter.<system> and a small checks.<system>.* derivation that uses the same formatter.


1. Why These Outputs Matter

Two flake outputs are especially practical in day-to-day use:

  • formatter.<system>, which powers nix fmt, and
  • checks.<system>.*, which powers nix flake check.

This example keeps both outputs small so the wiring is obvious.


2. The Important Connection

The flake points formatter.<system> at pkgs.nixfmt, then reuses that same formatter in a check:

formatter.${system} = pkgs.nixfmt;

That shows the main idea: a formatter output is just another derivation, so checks can use it too.


3. Commands to Try

cd 16-formatter-and-checks

nix fmt sample.nix
nix flake show
nix flake check