pre-commit-hooks-nix

Configure pre-commit hooks.

Generates a configuration for pre-commit, provides a script to activate it, and adds a check.

Pre-defined hooks are maintained at cachix/pre-commit-hooks.nix.

Installation

To use these options, add to your flake inputs:

pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix";

and inside the mkFlake:

imports = [
  inputs.pre-commit-hooks-nix.flakeModule
];

Run nix flake lock and you're set.

Options

perSystem.pre-commit.check.enable

perSystem.pre-commit.devShell

perSystem.pre-commit.installationScript

perSystem.pre-commit.pkgs

perSystem.pre-commit.settings

perSystem.pre-commit.settings.package

perSystem.pre-commit.settings.default_stages

perSystem.pre-commit.settings.excludes

perSystem.pre-commit.settings.hooks

perSystem.pre-commit.settings.hooks.<name>.enable

perSystem.pre-commit.settings.hooks.<name>.description

perSystem.pre-commit.settings.hooks.<name>.entry

perSystem.pre-commit.settings.hooks.<name>.excludes

perSystem.pre-commit.settings.hooks.<name>.fail_fast

perSystem.pre-commit.settings.hooks.<name>.files

perSystem.pre-commit.settings.hooks.<name>.language

perSystem.pre-commit.settings.hooks.<name>.name

perSystem.pre-commit.settings.hooks.<name>.pass_filenames

perSystem.pre-commit.settings.hooks.<name>.raw

perSystem.pre-commit.settings.hooks.<name>.require_serial

perSystem.pre-commit.settings.hooks.<name>.stages

perSystem.pre-commit.settings.hooks.<name>.types

perSystem.pre-commit.settings.hooks.<name>.types_or

perSystem.pre-commit.settings.hooks.<name>.verbose

perSystem.pre-commit.settings.installationScript

perSystem.pre-commit.settings.rootSrc

perSystem.pre-commit.settings.run

perSystem.pre-commit.settings.settings.alejandra.exclude

perSystem.pre-commit.settings.settings.ansible-lint.configPath

perSystem.pre-commit.settings.settings.ansible-lint.subdir

perSystem.pre-commit.settings.settings.autoflake.binPath

perSystem.pre-commit.settings.settings.autoflake.flags

perSystem.pre-commit.settings.settings.clippy.denyWarnings

perSystem.pre-commit.settings.settings.clippy.offline

perSystem.pre-commit.settings.settings.deadnix.edit

perSystem.pre-commit.settings.settings.deadnix.exclude

perSystem.pre-commit.settings.settings.deadnix.hidden

perSystem.pre-commit.settings.settings.deadnix.noLambdaArg

perSystem.pre-commit.settings.settings.deadnix.noLambdaPatternNames

perSystem.pre-commit.settings.settings.deadnix.noUnderscore

perSystem.pre-commit.settings.settings.deadnix.quiet

perSystem.pre-commit.settings.settings.dune-fmt.auto-promote

perSystem.pre-commit.settings.settings.dune-fmt.extraRuntimeInputs

perSystem.pre-commit.settings.settings.eslint.binPath

perSystem.pre-commit.settings.settings.eslint.extensions

perSystem.pre-commit.settings.settings.flake8.binPath

perSystem.pre-commit.settings.settings.flake8.format

perSystem.pre-commit.settings.settings.hlint.hintFile

perSystem.pre-commit.settings.settings.hpack.silent

perSystem.pre-commit.settings.settings.lua-ls.checklevel

perSystem.pre-commit.settings.settings.lua-ls.config

perSystem.pre-commit.settings.settings.markdownlint.config

perSystem.pre-commit.settings.settings.mypy.binPath

perSystem.pre-commit.settings.settings.nixfmt.width

perSystem.pre-commit.settings.settings.ormolu.cabalDefaultExtensions

perSystem.pre-commit.settings.settings.ormolu.defaultExtensions

perSystem.pre-commit.settings.settings.php-cs-fixer.binPath

perSystem.pre-commit.settings.settings.phpcbf.binPath

perSystem.pre-commit.settings.settings.phpcs.binPath

perSystem.pre-commit.settings.settings.prettier.binPath

perSystem.pre-commit.settings.settings.prettier.output

perSystem.pre-commit.settings.settings.prettier.write

perSystem.pre-commit.settings.settings.pylint.binPath

perSystem.pre-commit.settings.settings.pylint.reports

perSystem.pre-commit.settings.settings.pylint.score

perSystem.pre-commit.settings.settings.pyright.binPath

perSystem.pre-commit.settings.settings.pyupgrade.binPath

perSystem.pre-commit.settings.settings.revive.configPath

perSystem.pre-commit.settings.settings.rust.cargoManifestPath

perSystem.pre-commit.settings.settings.statix.format

perSystem.pre-commit.settings.settings.statix.ignore

perSystem.pre-commit.settings.settings.treefmt.package

perSystem.pre-commit.settings.settings.typos.diff

perSystem.pre-commit.settings.settings.typos.format

perSystem.pre-commit.settings.settings.typos.write

perSystem.pre-commit.settings.settings.yamllint.configPath

perSystem.pre-commit.settings.settings.yamllint.relaxed

perSystem.pre-commit.settings.src

perSystem.pre-commit.settings.tools

perSystem.pre-commit.check.enable

Whether to add a derivation to the flake checks. It will perform the pre-commit checks in nix flake check.

You can disable this if one of your hooks do not run properly in the Nix sandbox; for example because it needs network access.

Type: boolean

Default: true

Declared by:

pre-commit-hooks-nix/flake-module.nix

perSystem.pre-commit.devShell

A development shell with pre-commit installed and setup.

Type: package (read only)

Declared by:

pre-commit-hooks-nix/flake-module.nix

perSystem.pre-commit.installationScript

A bash fragment that sets up pre-commit.

Type: string (read only)

Default: bash statements

Declared by:

pre-commit-hooks-nix/flake-module.nix

perSystem.pre-commit.pkgs

Nixpkgs to use in the pre-commit settings.

Type: lazy attribute set of raw value

Default: pkgs (module argument)

Declared by:

pre-commit-hooks-nix/flake-module.nix

perSystem.pre-commit.settings

The pre-commit-hooks.nix configuration.

Type: submodule

Default: { }

Declared by:

pre-commit-hooks-nix/flake-module.nix

perSystem.pre-commit.settings.package

The pre-commit package to use.

Type: package

Default:

pkgs.pre-commit

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.default_stages

A configuration wide option for the stages property. Installs hooks to the defined stages. See https://pre-commit.com/#confining-hooks-to-run-at-certain-stages.

Type: list of string

Default:

[
  "commit"
]

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.excludes

Exclude files that were matched by these patterns.

Type: list of string

Default: [ ]

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks

The hook definitions.

You can both specify your own hooks here and you can enable predefined hooks.

Example of enabling a predefined hook:

hooks.nixpkgs-fmt.enable = true;

Example of a custom hook:

hooks.my-tool = {
  enable = true;
  name = "my-tool";
  description = "Run MyTool on all files in the project";
  files = "\\.mtl$";
  entry = "${pkgs.my-tool}/bin/mytoolctl";
};

The predefined hooks are:

actionlint

Static checker for GitHub Actions workflow files.

alejandra

The Uncompromising Nix Code Formatter.

ansible-lint

Ansible linter.

autoflake

Remove unused imports and variables from Python code.

bats

Run bash unit tests.

black

The uncompromising Python code formatter.

cabal-fmt

Format Cabal files

cabal2nix

Run cabal2nix on all *.cabal files to generate corresponding default.nix files.

cargo-check

Check the cargo package for errors.

checkmake

Experimental linter/analyzer for Makefiles.

chktex

LaTeX semantic checker

clang-format

Format your code using clang-format.

clippy

Lint Rust code.

commitizen

Check whether the current commit message follows commiting rules.

convco

cspell

A Spell Checker for Code

deadnix

Scan Nix files for dead code (unused variable bindings).

dhall-format

Dhall code formatter.

dune-fmt

Runs Dune’s formatters on the code tree.

dune-opam-sync

Check that Dune-generated OPAM files are in sync.

editorconfig-checker

Verify that the files are in harmony with the .editorconfig.

elm-format

Format Elm files.

elm-review

Analyzes Elm projects, to help find mistakes before your users find them.

elm-test

Run unit tests and fuzz tests for Elm code.

eslint

Find and fix problems in your JavaScript code.

flake8

Check the style and quality of Python files.

fourmolu

Haskell code prettifier.

fprettify

Auto-formatter for modern Fortran code.

gofmt

A tool that automatically formats Go source code

gotest

Run go tests

govet

Checks correctness of Go programs.

gptcommit

Generate a commit message using GPT3.

hadolint

Dockerfile linter, validate inline bash.

hindent

Haskell code prettifier.

hlint

HLint gives suggestions on how to improve your source code.

hpack

hpack converts package definitions in the hpack format (package.yaml) to Cabal files.

html-tidy

HTML linter.

hunspell

Spell checker and morphological analyzer.

isort

A Python utility / library to sort imports.

latexindent

Perl script to add indentation to LaTeX files.

lua-ls

Uses the lua-language-server CLI to statically type-check and lint Lua code.

luacheck

A tool for linting and static analysis of Lua code.

markdownlint

Style checker and linter for markdown files.

mdsh

Markdown shell pre-processor.

mypy

Static type checker for Python

nil

Incremental analysis assistant for writing in Nix.

nixfmt

Nix code prettifier.

nixpkgs-fmt

Nix code prettifier.

ocp-indent

A tool to indent OCaml code.

opam-lint

OCaml package manager configuration checker.

ormolu

Haskell code prettifier.

php-cs-fixer

Lint PHP files.

phpcbf

Lint PHP files.

phpcs

Lint PHP files.

prettier

Opinionated multi-language code formatter.

purs-tidy

Format purescript files.

purty

Format purescript files.

pylint

Lint Python files.

pyright

Static type checker for Python

pyupgrade

Automatically upgrade syntax for newer versions.

revive

A linter for Go source code.

ruff

An extremely fast Python linter, written in Rust.

rustfmt

Format Rust code.

shellcheck

Format shell files.

shfmt

Format shell files.

staticcheck

State of the art linter for the Go programming language

statix

Lints and suggestions for the Nix programming language.

stylish-haskell

A simple Haskell code prettifier

stylua

An Opinionated Lua Code Formatter.

tagref

Have tagref check all references and tags.

taplo

Format TOML files with taplo fmt

terraform-format

Format terraform (.tf) files.

tflint

A Pluggable Terraform Linter.

topiary

A universal formatter engine within the Tree-sitter ecosystem, with support for many languages.

treefmt

One CLI to format the code tree.

typos

Source code spell checker

yamllint

Yaml linter.

zprint

Beautifully format Clojure and Clojurescript source code and s-expressions.

Type: attribute set of (submodule)

Default: { }

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.enable

Whether to enable this pre-commit hook.

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.description

Description of the hook. used for metadata purposes only.

Type: string

Default: ""

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.entry

The entry point - the executable to run. entry can also contain arguments that will not be overridden, such as entry = "autopep8 -i";.

Type: string

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.excludes

Exclude files that were matched by these patterns.

Type: list of string

Default: [ ]

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.fail_fast

if true pre-commit will stop running hooks if this hook fails.

Type: boolean

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.files

The pattern of files to run on.

Type: string

Default: ""

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.language

The language of the hook - tells pre-commit how to install the hook.

Type: string

Default: "system"

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.name

The name of the hook - shown during hook execution.

Type: string

Default: internal name, same as id

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.pass_filenames

Whether to pass filenames as arguments to the entry point.

Type: boolean

Default: true

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.raw

Raw fields of a pre-commit hook. This is mostly for internal use but exposed in case you need to work around something.

Default: taken from the other hook options.

Type: attribute set of unspecified value

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.require_serial

if true this hook will execute using a single process instead of in parallel.

Type: boolean

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.stages

Confines the hook to run at a particular stage.

Type: list of string

Default: default_stages

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.types

List of file types to run on. See Filtering files with types.

Type: list of string

Default:

[
  "file"
]

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.types_or

List of file types to run on, where only a single type needs to match.

Type: list of string

Default: [ ]

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.hooks.<name>.verbose

forces the output of the hook to be printed even when the hook passes.

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.installationScript

A bash snippet that installs nix-pre-commit-hooks in the current directory

Type: string (read only)

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.rootSrc

The source of the project to be checked.

This is used in the derivation that performs the check.

If you use the flakeModule, the default is self.outPath; the whole flake sources.

Type: path

Default: gitignoreSource config.src

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.run

A derivation that tests whether the pre-commit hooks run cleanly on the entire project.

Type: package (read only)

Default: "<derivation>"

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.settings.alejandra.exclude

Files or directories to exclude from formatting.

Type: list of string

Default: [ ]

Example:

[
  "flake.nix"
  "./templates"
]

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.ansible-lint.configPath

path to the configuration YAML file

Type: string

Default: ""

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.ansible-lint.subdir

path to Ansible subdir

Type: string

Default: ""

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.autoflake.binPath

Path to autoflake binary.

Type: string

Default:

"${pkgs.autoflake}/bin/autoflake"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.autoflake.flags

Flags passed to autoflake.

Type: string

Default: "--in-place --expand-star-imports --remove-duplicate-keys --remove-unused-variables"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.clippy.denyWarnings

Fail when warnings are present

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.clippy.offline

Run clippy offline

Type: boolean

Default: true

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.deadnix.edit

Remove unused code and write to source file.

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.deadnix.exclude

Files to exclude from analysis.

Type: list of string

Default: [ ]

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.deadnix.hidden

Recurse into hidden subdirectories and process hidden .*.nix files.

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.deadnix.noLambdaArg

Don’t check lambda parameter arguments.

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.deadnix.noLambdaPatternNames

Don’t check lambda pattern names (don’t break nixpkgs callPackage).

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.deadnix.noUnderscore

Don’t check any bindings that start with a _.

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.deadnix.quiet

Don’t print a dead code report.

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.dune-fmt.auto-promote

Whether to auto-promote the changes.

Type: boolean

Default: true

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.dune-fmt.extraRuntimeInputs

Extra runtimeInputs to add to the environment, eg. ocamlformat.

Type: list of package

Default: [ ]

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.eslint.binPath

eslint binary path. E.g. if you want to use the eslint in node_modules, use ./node_modules/.bin/eslint.

Type: path

Default: ${tools.eslint}/bin/eslint

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.eslint.extensions

The pattern of files to run on, see https://pre-commit.com/#hooks-files.

Type: string

Default: "\\.js$"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.flake8.binPath

flake8 binary path. Should be used to specify flake8 binary from your Nix-managed Python environment.

Type: string

Default:

"${pkgs.python39Packages.flake8}/bin/flake8"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.flake8.format

Output format.

Type: string

Default: "default"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.hlint.hintFile

Path to hlint.yaml. By default, hlint searches for .hlint.yaml in the project root.

Type: null or path

Default: null

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.hpack.silent

Whether generation should be silent.

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.lua-ls.checklevel

The diagnostic check level

Type: one of “Error”, “Warning”, “Information”, “Hint”

Default: "Warning"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.lua-ls.config

See https://github.com/LuaLS/lua-language-server/wiki/Configuration-File#luarcjson

Type: attribute set

Default: { }

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.markdownlint.config

See https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.jsonc

Type: attribute set

Default: { }

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.mypy.binPath

Mypy binary path. Should be used to specify the mypy executable in an environment containing your typing stubs.

Type: string

Default:

"${pkgs.mypy}/bin/mypy"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.nixfmt.width

Line width.

Type: null or signed integer

Default: null

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.ormolu.cabalDefaultExtensions

Use default-extensions from .cabal files.

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.ormolu.defaultExtensions

Haskell language extensions to enable.

Type: list of string

Default: [ ]

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.php-cs-fixer.binPath

PHP-CS-Fixer binary path.

Type: string

Default:

"${pkgs.php81Packages.php-cs-fixer}/bin/php-cs-fixer"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.phpcbf.binPath

PHP_CodeSniffer binary path.

Type: string

Default:

"${pkgs.php80Packages.phpcbf}/bin/phpcbf"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.phpcs.binPath

PHP_CodeSniffer binary path.

Type: string

Default:

"${pkgs.php80Packages.phpcs}/bin/phpcs"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.prettier.binPath

prettier binary path. E.g. if you want to use the prettier in node_modules, use ./node_modules/.bin/prettier.

Type: path

Default:

"${tools.prettier}/bin/prettier"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.prettier.output

Output format.

Type: null or one of “check”, “list-different”

Default: "list-different"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.prettier.write

Whether to edit files inplace.

Type: boolean

Default: true

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.pylint.binPath

Pylint binary path. Should be used to specify Pylint binary from your Nix-managed Python environment.

Type: string

Default:

"${pkgs.python39Packages.pylint}/bin/pylint"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.pylint.reports

Whether to display a full report.

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.pylint.score

Whether to activate the evaluation score.

Type: boolean

Default: true

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.pyright.binPath

Pyright binary path. Should be used to specify the pyright executable in an environment containing your typing stubs.

Type: string

Default:

"${pkgs.pyright}/bin/pyright"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.pyupgrade.binPath

pyupgrade binary path. Should be used to specify the pyupgrade binary from your Nix-managed Python environment.

Type: string

Default:

"${pkgs.pyupgrade}/bin/pyupgrade"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.revive.configPath

Path to the configuration TOML file.

Type: string

Default: ""

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.rust.cargoManifestPath

Path to Cargo.toml

Type: null or string

Default: null

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.statix.format

Error Output format.

Type: one of “stderr”, “errfmt”, “json”

Default: "errfmt"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.statix.ignore

Globs of file patterns to skip.

Type: list of string

Default: [ ]

Example:

[
  "flake.nix"
  "_*"
]

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.treefmt.package

The treefmt package to use.

Should include all the formatters configured by treefmt.

For example:

pkgs.writeShellApplication {
  name = "treefmt";
  runtimeInputs = [
    pkgs.treefmt
    pkgs.nixpkgs-fmt
    pkgs.black
  ];
  text =
    ''
      exec treefmt "$@"
    '';
}

Type: package

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.typos.diff

Whether to print a diff of what would change.

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.typos.format

Output format.

Type: one of “silent”, “brief”, “long”, “json”

Default: "long"

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.typos.write

Whether to write fixes out.

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.yamllint.configPath

path to the configuration YAML file

Type: string

Default: ""

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.settings.yamllint.relaxed

Use the relaxed configuration

Type: boolean

Default: false

Declared by:

pre-commit-hooks-nix/modules/hooks.nix

perSystem.pre-commit.settings.src

Root of the project. By default this will be filtered with the gitignoreSource function later, unless rootSrc is specified.

If you use the flakeModule, the default is self.outPath; the whole flake sources.

Type: path

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix

perSystem.pre-commit.settings.tools

Tool set from which nix-pre-commit-hooks will pick binaries.

nix-pre-commit-hooks comes with its own set of packages for this purpose.

Type: lazy attribute set of (null or package)

Default: pre-commit-hooks.nix-pkgs.callPackage tools-dot-nix { inherit (pkgs) system; }

Declared by:

pre-commit-hooks-nix/modules/pre-commit.nix