854 B
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 powersnix fmt, andchecks.<system>.*, which powersnix 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