Pinned formatters and linters for Nix flakes. repofmt wraps treefmt; repochk runs file and project checks.
{
inputs.nix-tools.url = "github:kubijo/nix-tools";
outputs =
{ self, nix-tools }:
let
system = "x86_64-linux";
project = nix-tools.lib.configure {
inherit system;
src = self;
format.python = true;
lint.python = true;
};
in
{
formatter.${system} = project.formatter;
checks.${system} = project.checks;
apps.${system} = project.apps;
};
}nix fmt # format
nix run .#lint # lint
nix run .#validate # format, lint, then configured project steps
nix flake check # hermetic checks for CI
nix run .#coverage -- --json --check # audit tracked-file coverageSupports x86_64-linux, aarch64-linux and aarch64-darwin. Add project.packages to your dev shell if needed.
Formatting defaults: Nix, shell, Markdown, TOML, YAML, JSON and justfiles. Lint defaults: Nix, shell, YAML and CI workflows. Other tools are opt-in; see the tool tables. Unmatched formatter files are fatal by default.
Each language has independent format and lint entries. Use a boolean or an options attrset; an attrset enables the
entry unless enable = false.
format.php = true;
lint.php.extraOptions = [ "--semantics" ];
format.nunjucks.includes = [ "*.html.njk" ];
lint.nunjucks.includes = [ "*.html.njk" ];
format.yaml.configFile = ./yamlfmt.yml;
exclude = [ "vendor/**" ];
validate.steps = [ { name = "tests"; run = "pytest"; } ];Formatter includes support path globs; lint includes match basenames. HTML template entries require explicit, nonempty includes. Use whitespace formatting for non-HTML templates and retain project rendering/validation checks.
Keep the tool pin independent of your nixpkgs. Rust formatting requires your toolchain; SCSS and SVG formatting require
your nodejs. Details and overrides are in the reference.
Opt into outdated = true for an online Nix-input report via nix run .#outdated. Package-manager and GitHub Actions
inventories are separate opt-ins; standalone tool releases require explicit sources. See
outdated reports.
- Tools, options and exclusions
- PHP and Debian packaging
- Python dependency checks
- HTML templates · Salt and whitespace
- Custom tools · Project checks
- dirspec: TOML tree and metadata checks · Examples
- Grit · ast-grep
- Coverage audit · Pinning and cache
- Changelog