treefmt-nix

When working on large code trees, it's common to have multiple code formatters run against it. And have one script that loops over all of them. treefmt makes that nicer.

  • A unified CLI and output
  • Run all the formatters in parallel.
  • Cache which files have changed for super fast re-formatting.
  • Just type treefmt in any folder and it reformats the whole code tree.

This module is defined in numtide/treefmt-nix. The treefmt repo is about the tool itself.

Installation

To use these options, add to your flake inputs:

treefmt-nix.url = "github:numtide/treefmt-nix";

and inside the mkFlake:

imports = [
  inputs.treefmt-nix.flakeModule
];

Run nix flake lock and you're set.

Options

perSystem.treefmt

perSystem.treefmt.package

perSystem.treefmt.build.check

perSystem.treefmt.build.configFile

perSystem.treefmt.build.devShell

perSystem.treefmt.build.programs

perSystem.treefmt.build.wrapper

perSystem.treefmt.flakeCheck

perSystem.treefmt.flakeFormatter

perSystem.treefmt.programs.alejandra.enable

perSystem.treefmt.programs.alejandra.package

perSystem.treefmt.programs.beautysh.enable

perSystem.treefmt.programs.beautysh.package

perSystem.treefmt.programs.beautysh.indent_size

perSystem.treefmt.programs.black.enable

perSystem.treefmt.programs.black.package

perSystem.treefmt.programs.buildifier.enable

perSystem.treefmt.programs.buildifier.package

perSystem.treefmt.programs.buildifier.includes

perSystem.treefmt.programs.cabal-fmt.enable

perSystem.treefmt.programs.cabal-fmt.package

perSystem.treefmt.programs.clang-format.enable

perSystem.treefmt.programs.clang-format.package

perSystem.treefmt.programs.cue.enable

perSystem.treefmt.programs.cue.package

perSystem.treefmt.programs.deadnix.enable

perSystem.treefmt.programs.deadnix.package

perSystem.treefmt.programs.deadnix.no-lambda-arg

perSystem.treefmt.programs.deadnix.no-lambda-pattern-names

perSystem.treefmt.programs.deadnix.no-underscore

perSystem.treefmt.programs.deno.enable

perSystem.treefmt.programs.deno.package

perSystem.treefmt.programs.deno.excludes

perSystem.treefmt.programs.deno.includes

perSystem.treefmt.programs.dhall.enable

perSystem.treefmt.programs.dhall.package

perSystem.treefmt.programs.dhall.lint

perSystem.treefmt.programs.dprint.enable

perSystem.treefmt.programs.dprint.package

perSystem.treefmt.programs.dprint.settings.excludes

perSystem.treefmt.programs.dprint.settings.extends

perSystem.treefmt.programs.dprint.settings.includes

perSystem.treefmt.programs.dprint.settings.incremental

perSystem.treefmt.programs.dprint.settings.indentWidth

perSystem.treefmt.programs.dprint.settings.lineWidth

perSystem.treefmt.programs.dprint.settings.newLineKind

perSystem.treefmt.programs.dprint.settings.plugins

perSystem.treefmt.programs.dprint.settings.useTabs

perSystem.treefmt.programs.elm-format.enable

perSystem.treefmt.programs.elm-format.package

perSystem.treefmt.programs.erlfmt.enable

perSystem.treefmt.programs.erlfmt.package

perSystem.treefmt.programs.erlfmt.print-width

perSystem.treefmt.programs.fnlfmt.enable

perSystem.treefmt.programs.fnlfmt.package

perSystem.treefmt.programs.gofmt.enable

perSystem.treefmt.programs.gofmt.package

perSystem.treefmt.programs.gofumpt.enable

perSystem.treefmt.programs.gofumpt.package

perSystem.treefmt.programs.gofumpt.extra

perSystem.treefmt.programs.google-java-format.enable

perSystem.treefmt.programs.google-java-format.package

perSystem.treefmt.programs.hclfmt.enable

perSystem.treefmt.programs.hclfmt.package

perSystem.treefmt.programs.hlint.enable

perSystem.treefmt.programs.hlint.package

perSystem.treefmt.programs.isort.enable

perSystem.treefmt.programs.isort.package

perSystem.treefmt.programs.isort.profile

perSystem.treefmt.programs.ktlint.enable

perSystem.treefmt.programs.ktlint.package

perSystem.treefmt.programs.leptosfmt.enable

perSystem.treefmt.programs.leptosfmt.package

perSystem.treefmt.programs.mdformat.enable

perSystem.treefmt.programs.mdformat.package

perSystem.treefmt.programs.mdsh.enable

perSystem.treefmt.programs.mdsh.package

perSystem.treefmt.programs.mix-format.enable

perSystem.treefmt.programs.mix-format.package

perSystem.treefmt.programs.muon.enable

perSystem.treefmt.programs.muon.package

perSystem.treefmt.programs.mypy.enable

perSystem.treefmt.programs.mypy.directories

perSystem.treefmt.programs.mypy.directories.<name>.directory

perSystem.treefmt.programs.mypy.directories.<name>.extraPythonPackages

perSystem.treefmt.programs.mypy.directories.<name>.files

perSystem.treefmt.programs.mypy.directories.<name>.modules

perSystem.treefmt.programs.mypy.directories.<name>.options

perSystem.treefmt.programs.nixfmt.enable

perSystem.treefmt.programs.nixfmt.package

perSystem.treefmt.programs.nixpkgs-fmt.enable

perSystem.treefmt.programs.nixpkgs-fmt.package

perSystem.treefmt.programs.ocamlformat.enable

perSystem.treefmt.programs.ocamlformat.package

perSystem.treefmt.programs.ocamlformat.configFile

perSystem.treefmt.programs.ocamlformat.pkgs

perSystem.treefmt.programs.ormolu.enable

perSystem.treefmt.programs.ormolu.package

perSystem.treefmt.programs.ormolu.ghcOpts

perSystem.treefmt.programs.php-cs-fixer.enable

perSystem.treefmt.programs.php-cs-fixer.package

perSystem.treefmt.programs.prettier.enable

perSystem.treefmt.programs.prettier.package

perSystem.treefmt.programs.prettier.excludes

perSystem.treefmt.programs.prettier.includes

perSystem.treefmt.programs.prettier.settings.arrowParens

perSystem.treefmt.programs.prettier.settings.bracketSameLine

perSystem.treefmt.programs.prettier.settings.bracketSpacing

perSystem.treefmt.programs.prettier.settings.cursorOffset

perSystem.treefmt.programs.prettier.settings.editorconfig

perSystem.treefmt.programs.prettier.settings.embeddedLanguageFormatting

perSystem.treefmt.programs.prettier.settings.endOfLine

perSystem.treefmt.programs.prettier.settings.filepath

perSystem.treefmt.programs.prettier.settings.htmlWhitespaceSensitivity

perSystem.treefmt.programs.prettier.settings.insertPragma

perSystem.treefmt.programs.prettier.settings.jsxSingleQuote

perSystem.treefmt.programs.prettier.settings.overrides

perSystem.treefmt.programs.prettier.settings.parser

perSystem.treefmt.programs.prettier.settings.pluginSearchDirs

perSystem.treefmt.programs.prettier.settings.plugins

perSystem.treefmt.programs.prettier.settings.printWidth

perSystem.treefmt.programs.prettier.settings.proseWrap

perSystem.treefmt.programs.prettier.settings.quoteProps

perSystem.treefmt.programs.prettier.settings.rangeEnd

perSystem.treefmt.programs.prettier.settings.rangeStart

perSystem.treefmt.programs.prettier.settings.requirePragma

perSystem.treefmt.programs.prettier.settings.semi

perSystem.treefmt.programs.prettier.settings.singleAttributePerLine

perSystem.treefmt.programs.prettier.settings.singleQuote

perSystem.treefmt.programs.prettier.settings.tabWidth

perSystem.treefmt.programs.prettier.settings.trailingComma

perSystem.treefmt.programs.prettier.settings.useTabs

perSystem.treefmt.programs.prettier.settings.vueIndentScriptAndStyle

perSystem.treefmt.programs.protolint.enable

perSystem.treefmt.programs.protolint.package

perSystem.treefmt.programs.purs-tidy.enable

perSystem.treefmt.programs.purs-tidy.package

perSystem.treefmt.programs.ruff.enable

perSystem.treefmt.programs.ruff.package

perSystem.treefmt.programs.rufo.enable

perSystem.treefmt.programs.rufo.package

perSystem.treefmt.programs.rustfmt.enable

perSystem.treefmt.programs.rustfmt.package

perSystem.treefmt.programs.rustfmt.edition

perSystem.treefmt.programs.scalafmt.enable

perSystem.treefmt.programs.scalafmt.package

perSystem.treefmt.programs.shellcheck.enable

perSystem.treefmt.programs.shellcheck.package

perSystem.treefmt.programs.shfmt.enable

perSystem.treefmt.programs.shfmt.package

perSystem.treefmt.programs.shfmt.indent_size

perSystem.treefmt.programs.statix.enable

perSystem.treefmt.programs.statix.package

perSystem.treefmt.programs.statix.disabled-lints

perSystem.treefmt.programs.stylish-haskell.enable

perSystem.treefmt.programs.stylish-haskell.package

perSystem.treefmt.programs.stylua.enable

perSystem.treefmt.programs.stylua.package

perSystem.treefmt.programs.taplo.enable

perSystem.treefmt.programs.taplo.package

perSystem.treefmt.programs.terraform.enable

perSystem.treefmt.programs.terraform.package

perSystem.treefmt.programs.yamlfmt.enable

perSystem.treefmt.programs.yamlfmt.package

perSystem.treefmt.programs.zprint.enable

perSystem.treefmt.programs.zprint.package

perSystem.treefmt.programs.zprint.zprintOpts

perSystem.treefmt.projectRoot

perSystem.treefmt.projectRootFile

perSystem.treefmt.settings.formatter

perSystem.treefmt.settings.formatter.<name>.command

perSystem.treefmt.settings.formatter.<name>.excludes

perSystem.treefmt.settings.formatter.<name>.includes

perSystem.treefmt.settings.formatter.<name>.options

perSystem.treefmt.settings.global.excludes

perSystem.treefmt

Project-level treefmt configuration

Use config.treefmt.build.wrapper to get access to the resulting treefmt package based on this configuration.

By default treefmt-nix will set the formatter.<system> attribute of the flake, used by the nix fmt command.

Type: submodule

Declared by:

treefmt-nix/flake-module.nix

perSystem.treefmt.package

The treefmt package to use.

Type: package

Default: pkgs.treefmt

Declared by:

treefmt-nix/module-options.nix

perSystem.treefmt.build.check

Create a flake check to test that the given project tree is already formatted.

Input argument is the path to the project tree (usually ‘self’).

Type: function that evaluates to a(n) package

Default: Default check implementation

Declared by:

treefmt-nix/module-options.nix

perSystem.treefmt.build.configFile

Contains the generated config file derived from the settings.

Type: path

Declared by:

treefmt-nix/module-options.nix

perSystem.treefmt.build.devShell

The development shell with treefmt and its underlying programs

Type: package (read only)

Declared by:

treefmt-nix/module-options.nix

perSystem.treefmt.build.programs

Attrset of formatter programs enabled in treefmt configuration.

The key of the attrset is the formatter name, with the value being the package used to do the formatting.

Type: attribute set of package

Default: Programs used in configuration

Declared by:

treefmt-nix/module-options.nix

perSystem.treefmt.build.wrapper

The treefmt package, wrapped with the config file.

Type: package

Default: wrapped treefmt command

Declared by:

treefmt-nix/module-options.nix

perSystem.treefmt.flakeCheck

Add a flake check to run treefmt

Type: boolean

Default: true

Declared by:

treefmt-nix/flake-module.nix

perSystem.treefmt.flakeFormatter

Enables treefmt the default formatter used by the nix fmt command

Type: boolean

Default: true

Declared by:

treefmt-nix/flake-module.nix

perSystem.treefmt.programs.alejandra.enable

Whether to enable alejandra.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/alejandra.nix

perSystem.treefmt.programs.alejandra.package

The alejandra package to use.

Type: package

Default: pkgs.alejandra

Declared by:

treefmt-nix/programs/alejandra.nix

perSystem.treefmt.programs.beautysh.enable

Whether to enable beautysh.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/beautysh.nix

perSystem.treefmt.programs.beautysh.package

The beautysh package to use.

Type: package

Default: pkgs.beautysh

Declared by:

treefmt-nix/programs/beautysh.nix

perSystem.treefmt.programs.beautysh.indent_size

Sets the number of spaces to be used in indentation.

Type: signed integer

Default: 2

Example: 4

Declared by:

treefmt-nix/programs/beautysh.nix

perSystem.treefmt.programs.black.enable

Whether to enable black.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/black.nix

perSystem.treefmt.programs.black.package

The black package to use.

Type: package

Default: pkgs.black

Declared by:

treefmt-nix/programs/black.nix

perSystem.treefmt.programs.buildifier.enable

Whether to enable buildifier.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/buildifier.nix

perSystem.treefmt.programs.buildifier.package

The buildifier package to use.

Type: package

Default: pkgs.buildifier

Declared by:

treefmt-nix/programs/buildifier.nix

perSystem.treefmt.programs.buildifier.includes

Bazel file patterns to format

Type: list of string

Default:

[
  "BUILD.bazel"
  "*.bzl"
]

Declared by:

treefmt-nix/programs/buildifier.nix

perSystem.treefmt.programs.cabal-fmt.enable

Whether to enable cabal-fmt.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/cabal-fmt.nix

perSystem.treefmt.programs.cabal-fmt.package

cabal-fmt derivation to use.

Type: package

Default: pkgs.haskellPackages.cabal-fmt

Declared by:

treefmt-nix/programs/cabal-fmt.nix

perSystem.treefmt.programs.clang-format.enable

Whether to enable clang-format.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/clang-format.nix

perSystem.treefmt.programs.clang-format.package

The clang-tools package to use.

Type: package

Default: pkgs.clang-tools

Declared by:

treefmt-nix/programs/clang-format.nix

perSystem.treefmt.programs.cue.enable

Whether to enable cue.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/cue.nix

perSystem.treefmt.programs.cue.package

The cue package to use.

Type: package

Default: pkgs.cue

Declared by:

treefmt-nix/programs/cue.nix

perSystem.treefmt.programs.deadnix.enable

Whether to enable deadnix.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/deadnix.nix

perSystem.treefmt.programs.deadnix.package

The deadnix package to use.

Type: package

Default: pkgs.deadnix

Declared by:

treefmt-nix/programs/deadnix.nix

perSystem.treefmt.programs.deadnix.no-lambda-arg

Whether to enable Don’t check lambda parameter arguments.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/deadnix.nix

perSystem.treefmt.programs.deadnix.no-lambda-pattern-names

Whether to enable Don’t check lambda attrset pattern names (don’t break nixpkgs callPackage).

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/deadnix.nix

perSystem.treefmt.programs.deadnix.no-underscore

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

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/deadnix.nix

perSystem.treefmt.programs.deno.enable

Whether to enable deno.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/deno.nix

perSystem.treefmt.programs.deno.package

deno derivation to use.

Type: package

Default: pkgs.deno

Declared by:

treefmt-nix/programs/deno.nix

perSystem.treefmt.programs.deno.excludes

Path / file patterns to exclude for Deno

Type: list of string

Default: [ ]

Declared by:

treefmt-nix/programs/deno.nix

perSystem.treefmt.programs.deno.includes

Path / file patterns to include for Deno

Type: list of string

Default:

[
  "*.js"
  "*.json"
  "*.jsonc"
  "*.jsx"
  "*.markdown"
  "*.md"
  "*.ts"
  "*.tsx"
]

Declared by:

treefmt-nix/programs/deno.nix

perSystem.treefmt.programs.dhall.enable

Whether to enable Dhall.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/dhall.nix

perSystem.treefmt.programs.dhall.package

The Dhall package to use.

Type: package

Default: pkgs.dhall

Declared by:

treefmt-nix/programs/dhall.nix

perSystem.treefmt.programs.dhall.lint

Whether to lint in addition to formatting.

Type: boolean

Default: false

Declared by:

treefmt-nix/programs/dhall.nix

perSystem.treefmt.programs.dprint.enable

Whether to enable dprint.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/dprint.nix

perSystem.treefmt.programs.dprint.package

The dprint package to use.

Type: package

Default: pkgs.dprint

Declared by:

treefmt-nix/programs/dprint.nix

perSystem.treefmt.programs.dprint.settings.excludes

Array of patterns (globs) to exclude files or directories to format.

Type: null or (list of string)

Default: null

Example:

[
  "**/node_modules"
  "**/*-lock.json"
]

Declared by:

treefmt-nix/programs/dprint.nix

perSystem.treefmt.programs.dprint.settings.extends

Configurations to extend.

Type: null or string or list of string

Default: null

Example: "https://dprint.dev/path/to/config/file.v1.json"

Declared by:

treefmt-nix/programs/dprint.nix

perSystem.treefmt.programs.dprint.settings.includes

Array of patterns (globs) to use to find files to format.

Type: null or (list of string)

Default: null

Example:

[
  "**/*.{ts,tsx,js,jsx,mjs,json,md}"
]

Declared by:

treefmt-nix/programs/dprint.nix

perSystem.treefmt.programs.dprint.settings.incremental

Whether to format files only when they change.

Type: null or boolean

Default: null

Example: true

Declared by:

treefmt-nix/programs/dprint.nix

perSystem.treefmt.programs.dprint.settings.indentWidth

The number of characters for an indent

Type: null or signed integer

Default: null

Example: 2

Declared by:

treefmt-nix/programs/dprint.nix

perSystem.treefmt.programs.dprint.settings.lineWidth

The width of a line the printer will try to stay under. Note that the printer may exceed this width in certain cases.

Type: null or signed integer

Default: null

Example: 80

Declared by:

treefmt-nix/programs/dprint.nix

perSystem.treefmt.programs.dprint.settings.newLineKind

The kind of newline to use (one of: auto, crlf, lf, system).

Type: null or string

Default: null

Example: "auto"

Declared by:

treefmt-nix/programs/dprint.nix

perSystem.treefmt.programs.dprint.settings.plugins

Array of plugin URLs to format files.

Type: null or (list of string)

Default: null

Example:

[
  "https://plugins.dprint.dev/json-0.17.2.wasm"
  "https://plugins.dprint.dev/markdown-0.15.2.wasm"
  "https://plugins.dprint.dev/typescript-0.84.4.wasm"
]

Declared by:

treefmt-nix/programs/dprint.nix

perSystem.treefmt.programs.dprint.settings.useTabs

Whether to use tabs (true) or spaces (false) for indentation.

Type: null or boolean

Default: null

Example: true

Declared by:

treefmt-nix/programs/dprint.nix

perSystem.treefmt.programs.elm-format.enable

Whether to enable elm-format.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/elm-format.nix

perSystem.treefmt.programs.elm-format.package

elm-format derivation to use.

Type: package

Default: pkgs.elmPackages.elm-format

Declared by:

treefmt-nix/programs/elm-format.nix

perSystem.treefmt.programs.erlfmt.enable

Whether to enable erlfmt.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/erlfmt.nix

perSystem.treefmt.programs.erlfmt.package

The erlfmt package to use.

Type: package

Default: pkgs.erlfmt

Declared by:

treefmt-nix/programs/erlfmt.nix

perSystem.treefmt.programs.erlfmt.print-width

The line length that formatter would wrap on

Type: signed integer

Default: 100

Example: 80

Declared by:

treefmt-nix/programs/erlfmt.nix

perSystem.treefmt.programs.fnlfmt.enable

Whether to enable fnlfmt.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/fnlfmt.nix

perSystem.treefmt.programs.fnlfmt.package

The fnlfmt package to use.

Type: package

Default: pkgs.fnlfmt

Declared by:

treefmt-nix/programs/fnlfmt.nix

perSystem.treefmt.programs.gofmt.enable

Whether to enable gofmt.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/gofmt.nix

perSystem.treefmt.programs.gofmt.package

The go package to use.

Type: package

Default: pkgs.go

Declared by:

treefmt-nix/programs/gofmt.nix

perSystem.treefmt.programs.gofumpt.enable

Whether to enable gofumpt.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/gofumpt.nix

perSystem.treefmt.programs.gofumpt.package

The gofumpt package to use.

Type: package

Default: pkgs.gofumpt

Declared by:

treefmt-nix/programs/gofumpt.nix

perSystem.treefmt.programs.gofumpt.extra

Whether to enable extra rules.

Type: boolean

Default: false

Declared by:

treefmt-nix/programs/gofumpt.nix

perSystem.treefmt.programs.google-java-format.enable

Whether to enable google-java-format.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/google-java-format.nix

perSystem.treefmt.programs.google-java-format.package

The google-java-format package to use.

Type: package

Default: pkgs.google-java-format

Declared by:

treefmt-nix/programs/google-java-format.nix

perSystem.treefmt.programs.hclfmt.enable

Whether to enable hclfmt.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/hclfmt.nix

perSystem.treefmt.programs.hclfmt.package

The hclfmt package to use.

Type: package

Default: pkgs.hclfmt

Declared by:

treefmt-nix/programs/hclfmt.nix

perSystem.treefmt.programs.hlint.enable

Whether to enable hlint.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/hlint.nix

perSystem.treefmt.programs.hlint.package

The hlint package to use.

Type: package

Default: pkgs.hlint

Declared by:

treefmt-nix/programs/hlint.nix

perSystem.treefmt.programs.isort.enable

Whether to enable isort.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/isort.nix

perSystem.treefmt.programs.isort.package

The isort package to use.

Type: package

Default: pkgs.isort

Declared by:

treefmt-nix/programs/isort.nix

perSystem.treefmt.programs.isort.profile

The profile to use for isort.

Type: string

Default: ""

Declared by:

treefmt-nix/programs/isort.nix

perSystem.treefmt.programs.ktlint.enable

Whether to enable ktlint.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/ktlint.nix

perSystem.treefmt.programs.ktlint.package

The ktlint package to use.

Type: package

Default: pkgs.ktlint

Declared by:

treefmt-nix/programs/ktlint.nix

perSystem.treefmt.programs.leptosfmt.enable

Whether to enable leptosfmt.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/leptosfmt.nix

perSystem.treefmt.programs.leptosfmt.package

The leptosfmt package to use.

Type: package

Default: pkgs.leptosfmt

Declared by:

treefmt-nix/programs/leptosfmt.nix

perSystem.treefmt.programs.mdformat.enable

Whether to enable mdformat.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/mdformat.nix

perSystem.treefmt.programs.mdformat.package

The mdformat package to use.

Type: package

Default: pkgs.python3Packages.mdformat

Declared by:

treefmt-nix/programs/mdformat.nix

perSystem.treefmt.programs.mdsh.enable

Whether to enable mdsh.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/mdsh.nix

perSystem.treefmt.programs.mdsh.package

The mdsh package to use.

Type: package

Default: pkgs.mdsh

Declared by:

treefmt-nix/programs/mdsh.nix

perSystem.treefmt.programs.mix-format.enable

Whether to enable mix-format.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/mix-format.nix

perSystem.treefmt.programs.mix-format.package

The elixir package to use.

Type: package

Default: pkgs.elixir

Declared by:

treefmt-nix/programs/mix-format.nix

perSystem.treefmt.programs.muon.enable

Whether to enable muon.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/muon.nix

perSystem.treefmt.programs.muon.package

The muon package to use.

Type: package

Default: pkgs.muon

Declared by:

treefmt-nix/programs/muon.nix

perSystem.treefmt.programs.mypy.enable

Whether to enable mypy.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/mypy.nix

perSystem.treefmt.programs.mypy.directories

Directories to run mypy in

Type: attribute set of (submodule)

Default:

{
  "." = { };
}

Example:

{
  "." = {
    modules = [
      "mymodule"
      "tests"
    ];
  };
  "./subdir" = {
    modules = [
      "."
    ];
  };
}

Declared by:

treefmt-nix/programs/mypy.nix

perSystem.treefmt.programs.mypy.directories.<name>.directory

Directory to run mypy in

Type: string

Default: "‹name›"

Declared by:

treefmt-nix/programs/mypy.nix

perSystem.treefmt.programs.mypy.directories.<name>.extraPythonPackages

Extra packages to add to PYTHONPATH

Type: list of package

Default: [ ]

Example: [ pkgs.python3.pkgs.requests ]

Declared by:

treefmt-nix/programs/mypy.nix

perSystem.treefmt.programs.mypy.directories.<name>.files

Single files to check. Can be globs

Type: list of string

Default: [ ]

Example:

[
  "./**/tasks.py"
]

Declared by:

treefmt-nix/programs/mypy.nix

perSystem.treefmt.programs.mypy.directories.<name>.modules

Modules to check

Type: list of string

Default:

[
  "."
]

Example:

[
  "mymodule"
  "tests"
]

Declared by:

treefmt-nix/programs/mypy.nix

perSystem.treefmt.programs.mypy.directories.<name>.options

Options to pass to mypy

Type: list of string

Default: [ ]

Example:

[
  "--ignore-missing-imports"
]

Declared by:

treefmt-nix/programs/mypy.nix

perSystem.treefmt.programs.nixfmt.enable

Whether to enable nixfmt.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/nixfmt.nix

perSystem.treefmt.programs.nixfmt.package

The nixfmt package to use.

Type: package

Default: pkgs.nixfmt

Declared by:

treefmt-nix/programs/nixfmt.nix

perSystem.treefmt.programs.nixpkgs-fmt.enable

Whether to enable nixpkgs-fmt.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/nixpkgs-fmt.nix

perSystem.treefmt.programs.nixpkgs-fmt.package

The nixpkgs-fmt package to use.

Type: package

Default: pkgs.nixpkgs-fmt

Declared by:

treefmt-nix/programs/nixpkgs-fmt.nix

perSystem.treefmt.programs.ocamlformat.enable

Whether to enable ocamlformat.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/ocamlformat.nix

perSystem.treefmt.programs.ocamlformat.package

The ocamlformat package to use.

Type: package

Default: pkgs.ocamlformat

Declared by:

treefmt-nix/programs/ocamlformat.nix

perSystem.treefmt.programs.ocamlformat.configFile

Path to the .ocamlformat file. Used to pick the right version of ocamlformat if passed.

Type: null or path

Default: null

Declared by:

treefmt-nix/programs/ocamlformat.nix

perSystem.treefmt.programs.ocamlformat.pkgs

The package set used to get the ocamlformat package at a specific version.

Type: lazy attribute set of raw value

Default: Nixpkgs from context

Declared by:

treefmt-nix/programs/ocamlformat.nix

perSystem.treefmt.programs.ormolu.enable

Whether to enable ormolu.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/ormolu.nix

perSystem.treefmt.programs.ormolu.package

The ormolu package to use.

Type: package

Default: pkgs.ormolu

Declared by:

treefmt-nix/programs/ormolu.nix

perSystem.treefmt.programs.ormolu.ghcOpts

Which GHC language extensions to enable

Type: unspecified value

Default:

[
  "BangPatterns"
  "PatternSynonyms"
  "TypeApplications"
]

Declared by:

treefmt-nix/programs/ormolu.nix

perSystem.treefmt.programs.php-cs-fixer.enable

Whether to enable php-cs-fixer.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/php-cs-fixer.nix

perSystem.treefmt.programs.php-cs-fixer.package

The php-cs-fixer package to use.

Type: package

Default: pkgs.php-cs-fixer

Declared by:

treefmt-nix/programs/php-cs-fixer.nix

perSystem.treefmt.programs.prettier.enable

Whether to enable prettier.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.package

prettier derivation to use.

Type: package

Default: pkgs.nodePackages.prettier

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.excludes

Path / file patterns to exclude for Prettier

Type: list of string

Default: [ ]

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.includes

Path / file patterns to include for Prettier

Type: list of string

Default:

[
  "*.css"
  "*.html"
  "*.js"
  "*.json"
  "*.jsx"
  "*.md"
  "*.mdx"
  "*.scss"
  "*.ts"
  "*.tsx"
  "*.yaml"
  "*.yml"
]

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.arrowParens

Include parentheses around a sole arrow function parameter.

Type: null or one of “always”, “avoid”

Default: null

Example: "always"

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.bracketSameLine

Put > of opening tags on the last line instead of on a new line.

Type: null or boolean

Default: null

Example: false

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.bracketSpacing

Print spaces between brackets

Type: null or boolean

Default: null

Example: true

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.cursorOffset

Print (to stderr) where a cursor at the given position would move to after formatting. This option cannot be used with --range-start and –range-end.

Type: null or signed integer

Default: null

Example: -1

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.editorconfig

Whether parse the .editorconfig file in your project and convert its properties to the corresponding Prettier configuration. This configuration will be overridden by .prettierrc, etc.

Type: null or boolean

Default: null

Example: false

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.embeddedLanguageFormatting

Control how Prettier formats quoted code embedded in the file.

Type: null or one of “auto”, “off”

Default: null

Example: "auto"

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.endOfLine

Which end of line characters to apply.

Type: null or one of “lf”, “crlf”, “cr”, “auto”

Default: null

Example: "lf"

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.filepath

Specify the input filepath. This will be used to do parser inference.

Type: null or string

Default: null

Example: "example.js"

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.htmlWhitespaceSensitivity

How to handle whitespaces in HTML.

Type: null or one of “css”, “strict”, “ignore”

Default: null

Example: "css"

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.insertPragma

Insert @format pragma into file’s first docblock commentypes.

Type: null or boolean

Default: null

Example: false

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.jsxSingleQuote

Use single quotes in JSX

Type: null or boolean

Default: null

Example: false

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.overrides

Provide a list of patterns to override prettier configuration.

Type: null or (list of (attribute set))

Default: null

Example:

{
  files = [
    "*.html"
    "legacy/**/*.js"
  ];
  options = {
    tabwidth = 4;
  };
}

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.parser

Which parser to use.

Type: null or one of “flow”, “babel”, “babel-flow”, “babel-ts”, “typescript”, “acorn”, “espree”, “meriyah”, “css”, “less”, “scss”, “json”, “json5”, “json-stringify”, “graphql”, “markdown”, “mdx”, “vue”, “yaml”, “glimmer”, “html”, “angular”, “lwc” or string

Default: null

Example: "typescript"

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.pluginSearchDirs

Custom directory that contains prettier plugins in node_modules subdirectory. Overrides default behavior when plugins are searched relatively to the location of Prettier.\nMultiple values are accepted.

Type: null or (list of string) or value false (singular enum)

Default: null

Example: false

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.plugins

Add a plugin. Multiple plugins can be passed as separate --plugins.

Type: null or (list of string)

Default: null

Example:

[
  "@prettier/plugin-xml"
]

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.printWidth

The line length where Prettier will try wrap.

Type: null or signed integer

Default: null

Example: 80

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.proseWrap

How to wrap prose.

Type: null or one of “always”, “never”, “preserve”

Default: null

Example: "preserve"

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.quoteProps

Change when properties in objects are quoted

Type: null or one of “as-needed”, “consistent”, “preserve”

Default: null

Example: "as-needed"

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.rangeEnd

Format code ending at a given character offset (exclusive). The range will extend forwards to the end of the selected statementypes. This option cannot be used with --cursor-offsetypes.

Type: null or string

Default: null

Example: 0

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.rangeStart

Format code starting at a given character offsetypes. The range will extend backwards to the start of the first line containing the selected statementypes. his option cannot be used with --cursor-offsetypes.

Type: null or signed integer

Default: null

Example: 0

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.requirePragma

Require either ‘@prettier’ or ‘@format’ to be present in the file’s first docblock comment\nin order for it to be formatted.

Type: null or boolean

Default: null

Example: false

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.semi

Print semicolons.

Type: null or boolean

Default: null

Example: false

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.singleAttributePerLine

Enforce single attribute per line in HTML, Vue and JSX.

Type: null or boolean

Default: null

Example: false

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.singleQuote

Use single quotes instead of double quotes.

Type: null or boolean

Default: null

Example: false

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.tabWidth

Number of spaces per indentation level.

Type: null or signed integer

Default: null

Example: 2

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.trailingComma

Print trailing commas wherever possible when multi-line.

Type: null or one of “es5”, “none”, “all”

Default: null

Example: "es5"

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.useTabs

Indent with tabs instead of spaces

Type: null or boolean

Default: null

Example: false

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.prettier.settings.vueIndentScriptAndStyle

Indent script and style tags in Vue files.

Type: null or boolean

Default: null

Example: false

Declared by:

treefmt-nix/programs/prettier.nix

perSystem.treefmt.programs.protolint.enable

Whether to enable protolint.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/protolint.nix

perSystem.treefmt.programs.protolint.package

The protolint package to use.

Type: package

Default: pkgs.protolint

Declared by:

treefmt-nix/programs/protolint.nix

perSystem.treefmt.programs.purs-tidy.enable

Whether to enable purs-tidy.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/purs-tidy.nix

perSystem.treefmt.programs.purs-tidy.package

purs-tidy derivation to use.

Type: package

Default: pkgs.nodePackages.purs-tidy

Declared by:

treefmt-nix/programs/purs-tidy.nix

perSystem.treefmt.programs.ruff.enable

Whether to enable ruff.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/ruff.nix

perSystem.treefmt.programs.ruff.package

The ruff package to use.

Type: package

Default: pkgs.ruff

Declared by:

treefmt-nix/programs/ruff.nix

perSystem.treefmt.programs.rufo.enable

Whether to enable rufo.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/rufo.nix

perSystem.treefmt.programs.rufo.package

The rufo package to use.

Type: package

Default: pkgs.rufo

Declared by:

treefmt-nix/programs/rufo.nix

perSystem.treefmt.programs.rustfmt.enable

Whether to enable rustfmt.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/rustfmt.nix

perSystem.treefmt.programs.rustfmt.package

The rustfmt package to use.

Type: package

Default: pkgs.rustfmt

Declared by:

treefmt-nix/programs/rustfmt.nix

perSystem.treefmt.programs.rustfmt.edition

Rust edition to target when formatting

Type: string

Default: "2021"

Declared by:

treefmt-nix/programs/rustfmt.nix

perSystem.treefmt.programs.scalafmt.enable

Whether to enable scalafmt.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/scalafmt.nix

perSystem.treefmt.programs.scalafmt.package

The scalafmt package to use.

Type: package

Default: pkgs.scalafmt

Declared by:

treefmt-nix/programs/scalafmt.nix

perSystem.treefmt.programs.shellcheck.enable

Whether to enable shellcheck.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/shellcheck.nix

perSystem.treefmt.programs.shellcheck.package

The shellcheck package to use.

Type: package

Default: pkgs.shellcheck

Declared by:

treefmt-nix/programs/shellcheck.nix

perSystem.treefmt.programs.shfmt.enable

Whether to enable shfmt.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/shfmt.nix

perSystem.treefmt.programs.shfmt.package

The shfmt package to use.

Type: package

Default: pkgs.shfmt

Declared by:

treefmt-nix/programs/shfmt.nix

perSystem.treefmt.programs.shfmt.indent_size

Sets the number of spaces to be used in indentation. Uses tabs if set to zero. If this is null, then .editorconfig will be used to configure shfmt.

Type: null or signed integer

Default: 2

Example: 4

Declared by:

treefmt-nix/programs/shfmt.nix

perSystem.treefmt.programs.statix.enable

Whether to enable statix.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/statix.nix

perSystem.treefmt.programs.statix.package

The statix package to use.

Type: package

Default: pkgs.statix

Declared by:

treefmt-nix/programs/statix.nix

perSystem.treefmt.programs.statix.disabled-lints

List of ignored lints. Run statix list to see all available lints.

Type: list of string

Default: [ ]

Example:

[
  "empty_pattern"
]

Declared by:

treefmt-nix/programs/statix.nix

perSystem.treefmt.programs.stylish-haskell.enable

Whether to enable stylish-haskell.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/stylish-haskell.nix

perSystem.treefmt.programs.stylish-haskell.package

The stylish-haskell package to use.

Type: package

Default: pkgs.stylish-haskell

Declared by:

treefmt-nix/programs/stylish-haskell.nix

perSystem.treefmt.programs.stylua.enable

Whether to enable stylua.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/stylua.nix

perSystem.treefmt.programs.stylua.package

The stylua package to use.

Type: package

Default: pkgs.stylua

Declared by:

treefmt-nix/programs/stylua.nix

perSystem.treefmt.programs.taplo.enable

Whether to enable taplo.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/taplo.nix

perSystem.treefmt.programs.taplo.package

The taplo package to use.

Type: package

Default: pkgs.taplo

Declared by:

treefmt-nix/programs/taplo.nix

perSystem.treefmt.programs.terraform.enable

Whether to enable terraform.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/terraform.nix

perSystem.treefmt.programs.terraform.package

The terraform package to use.

Type: package

Default: pkgs.terraform

Declared by:

treefmt-nix/programs/terraform.nix

perSystem.treefmt.programs.yamlfmt.enable

Whether to enable yamlfmt.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/yamlfmt.nix

perSystem.treefmt.programs.yamlfmt.package

The yamlfmt package to use.

Type: package

Default: pkgs.yamlfmt

Declared by:

treefmt-nix/programs/yamlfmt.nix

perSystem.treefmt.programs.zprint.enable

Whether to enable zprint.

Type: boolean

Default: false

Example: true

Declared by:

treefmt-nix/programs/zprint.nix

perSystem.treefmt.programs.zprint.package

zprint derivation to use.

Type: package

Default: pkgs.zprint

Declared by:

treefmt-nix/programs/zprint.nix

perSystem.treefmt.programs.zprint.zprintOpts

Clojure map containing zprint options.

Type: null or string

Default: null

Example: "{:width 90}"

Declared by:

treefmt-nix/programs/zprint.nix

perSystem.treefmt.projectRoot

Path to the root of the project on which treefmt operates

Type: path

Default: self

Declared by:

treefmt-nix/flake-module.nix

perSystem.treefmt.projectRootFile

File to look for to determine the root of the project in the build.wrapper.

Type: unspecified value

Example: "flake.nix"

Declared by:

treefmt-nix/module-options.nix

perSystem.treefmt.settings.formatter

Set of formatters to use

Type: attribute set of (submodule)

Default: { }

Declared by:

treefmt-nix/module-options.nix

perSystem.treefmt.settings.formatter.<name>.command

Executable obeying the treefmt formatter spec

Type: Path to executable

Declared by:

treefmt-nix/module-options.nix

perSystem.treefmt.settings.formatter.<name>.excludes

List of files to exclude for formatting. Supports globbing. Takes precedence over the includes.

Type: list of string

Default: [ ]

Declared by:

treefmt-nix/module-options.nix

perSystem.treefmt.settings.formatter.<name>.includes

List of files to include for formatting. Supports globbing.

Type: list of string

Declared by:

treefmt-nix/module-options.nix

perSystem.treefmt.settings.formatter.<name>.options

List of arguments to pass to the command

Type: list of string

Default: [ ]

Declared by:

treefmt-nix/module-options.nix

perSystem.treefmt.settings.global.excludes

A global list of paths to exclude. Supports glob.

Type: list of string

Default: [ ]

Example:

[
  "./node_modules/**"
]

Declared by:

treefmt-nix/module-options.nix