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

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:

perSystem.treefmt.package

The treefmt package to use.

Type: package

Default: pkgs.treefmt

Declared by:

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:

perSystem.treefmt.build.configFile

Contains the generated config file derived from the settings.

Type: path

Declared by:

perSystem.treefmt.build.devShell

The development shell with treefmt and its underlying programs

Type: package (read only)

Declared by:

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:

perSystem.treefmt.build.wrapper

The treefmt package, wrapped with the config file.

Type: package

Default: wrapped treefmt command

Declared by:

perSystem.treefmt.flakeCheck

Add a flake check to run treefmt

Type: boolean

Default: true

Declared by:

perSystem.treefmt.flakeFormatter

Enables treefmt the default formatter used by the nix fmt command

Type: boolean

Default: true

Declared by:

perSystem.treefmt.programs.alejandra.enable

Whether to enable alejandra.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.alejandra.package

The alejandra package to use.

Type: package

Default: pkgs.alejandra

Declared by:

perSystem.treefmt.programs.asmfmt.enable

Whether to enable asmfmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.asmfmt.package

The asmfmt package to use.

Type: package

Default: pkgs.asmfmt

Declared by:

perSystem.treefmt.programs.beautysh.enable

Whether to enable beautysh.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.beautysh.package

The beautysh package to use.

Type: package

Default: pkgs.beautysh

Declared by:

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:

perSystem.treefmt.programs.biome.enable

Whether to enable biome.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.biome.package

The biome package to use.

Type: package

Default: pkgs.biome

Declared by:

perSystem.treefmt.programs.biome.excludes

Path / file patterns to exclude for Biome

Type: list of string

Default: [ ]

Example:

[
  "*.mjs"
]

Declared by:

perSystem.treefmt.programs.biome.includes

Path / file patterns to include for Biome

Type: list of string

Default:

[
  "*.js"
  "*.ts"
  "*.mjs"
  "*.mts"
  "*.cjs"
  "*.cts"
  "*.jsx"
  "*.tsx"
  "*.d.ts"
  "*.d.cts"
  "*.d.mts"
  "*.json"
  "*.jsonc"
]

Example:

[
  "*.mjs"
]

Declared by:

perSystem.treefmt.programs.biome.settings.formatter.enabled

Enables Biome’s formatter

Type: boolean

Default: true

Example: false

Declared by:

perSystem.treefmt.programs.biome.settings.formatter.formatWithErrors

Allows to format a document that has syntax errors.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.biome.settings.formatter.ignore

A list of Unix shell style patterns. Biome ignores files and folders that match these patterns.

Type: list of string

Default: [ ]

Example:

[
  "scripts/*.js"
]

Declared by:

perSystem.treefmt.programs.biome.settings.formatter.include

A list of Unix shell style patterns. Biome handles only the files and folders that match these patterns.

[!Caution] When both include and ignore are specified, ignore takes precedence over include

Type: list of string

Default: [ ]

Example:

[
  "scripts/*.js"
]

Declared by:

perSystem.treefmt.programs.biome.settings.formatter.indentStyle

The style of the indentation. It can be tab or space.

Type: one of “tab”, “space”

Default: "tab"

Example: "space"

Declared by:

perSystem.treefmt.programs.biome.settings.formatter.indentWidth

How big the indentation should be.

Type: signed integer

Default: 2

Example: 4

Declared by:

perSystem.treefmt.programs.biome.settings.formatter.lineEnding

The type of line ending.

Type: one of “lf”, “crlf”, “cr”

Default: "lf"

Example: "cr"

Declared by:

perSystem.treefmt.programs.biome.settings.formatter.lineWidth

How many characters can be written on a single line.

Type: signed integer

Default: 80

Example: 90

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.formatter.enabled

Enables Biome’s formatter for JavaScript (and its super languages) files.

Type: boolean

Default: true

Example: false

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.formatter.arrowParentheses

Whether to add non-necessary parentheses to arrow functions:

  • always, the parentheses are always added;
  • asNeeded, the parentheses are added only when they are needed;

Type: one of “always”, “asNeeded”

Default: "always"

Example: "asNeeded"

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.formatter.bracketSameLine

Choose whether the ending > of a multi-line JSX element should be on the last attribute line or not

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.formatter.bracketSpacing

Choose whether spaces should be added between brackets and inner values

Type: boolean

Default: true

Example: false

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.formatter.indentStyle

The style of the indentation. It can be tab or space.

Type: one of “tab”, “space”

Default: "tab"

Example: "space"

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.formatter.indentWidth

How big the indentation should be.

Type: signed integer

Default: 2

Example: 4

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.formatter.jsxQuoteStyle

The type of quote used when representing jsx string literals. It can be single or double.

Type: one of “single”, “double”

Default: "double"

Example: "single"

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.formatter.lineEnding

The type of line ending.

Type: one of “lf”, “crlf”, “cr”

Default: "lf"

Example: "cr"

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.formatter.lineWidth

How many characters can be written on a single line.

Type: signed integer

Default: 80

Example: 90

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.formatter.quoteProperties

When properties inside objects should be quoted. It can be asNeeded or preserve.

Type: one of “asNeeded”, “preserve”

Default: "asNeeded"

Example: "preserve"

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.formatter.quoteStyle

The type of quote used when representing string literals. It can be single or double.

Type: one of “single”, “double”

Default: "double"

Example: "single"

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.formatter.semicolons

It configures where the formatter prints semicolons:

  • always, the semicolons is always added at the end of each statement;
  • asNeeded, the semicolons are added only in places where it’s needed, to protect from ASI

Type: one of “always”, “asNeeded”

Default: "always"

Example: "asNeeded"

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.formatter.trailingComma

Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Possible values:

  • all, the trailing comma is always added
  • es5, the trailing comma is added only in places where it’s supported by older version of JavaScript
  • none, trailing commas are never added

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

Default: "all"

Example: "none"

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.globals

A list of global names that Biome should ignore

Type: list of string

Default: [ ]

Example:

[
  "$"
  "_"
  "externalVariable"
]

Declared by:

perSystem.treefmt.programs.biome.settings.javascript.parser.unsafeParameterDecoratorsEnabled

Allows to support the unsafe/experimental parameter decorators.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.biome.settings.json.formatter.enabled

Enables Biome’s formatter for JSON (and its super languages) files.

Type: boolean

Default: true

Example: false

Declared by:

perSystem.treefmt.programs.biome.settings.json.formatter.indentStyle

The style of the indentation. It can be tab or space.

Type: one of “tab”, “space”

Default: "tab"

Example: "space"

Declared by:

perSystem.treefmt.programs.biome.settings.json.formatter.indentWidth

How big the indentation should be.

Type: signed integer

Default: 2

Example: 4

Declared by:

perSystem.treefmt.programs.biome.settings.json.formatter.lineEnding

The type of line ending.

Type: one of “lf”, “crlf”, “cr”

Default: "lf"

Example: "cr"

Declared by:

perSystem.treefmt.programs.biome.settings.json.formatter.lineWidth

How many characters can be written on a single line.

Type: signed integer

Default: 80

Example: 90

Declared by:

perSystem.treefmt.programs.biome.settings.json.parser.allowComments

Enables the parsing of comments in JSON files.

Type: boolean

Default: true

Example: false

Declared by:

perSystem.treefmt.programs.biome.settings.json.parser.allowTrailingCommas

Enables the parsing of trailing Commas in JSON files.

Type: boolean

Default: true

Example: false

Declared by:

perSystem.treefmt.programs.biome.settings.organizeImports.enabled

Enables Biome’s sort imports.

Type: boolean

Default: true

Example: false

Declared by:

perSystem.treefmt.programs.biome.settings.organizeImports.ignore

A list of Unix shell style patterns. Biome ignores files and folders that match these patterns.

Type: list of string

Default: [ ]

Example:

[
  "scripts/*.js"
]

Declared by:

perSystem.treefmt.programs.biome.settings.organizeImports.include

A list of Unix shell style patterns. Biome handles only the files and folders that match these patterns.

[!Caution] When both include and ignore are specified, ignore takes precedence over include

Type: list of string

Default: [ ]

Example:

[
  "scripts/*.js"
]

Declared by:

perSystem.treefmt.programs.black.enable

Whether to enable black.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.black.package

The black package to use.

Type: package

Default: pkgs.black

Declared by:

perSystem.treefmt.programs.buildifier.enable

Whether to enable buildifier.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.buildifier.package

The buildifier package to use.

Type: package

Default: pkgs.buildifier

Declared by:

perSystem.treefmt.programs.buildifier.includes

Bazel file patterns to format

Type: list of string

Default:

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

Declared by:

perSystem.treefmt.programs.cabal-fmt.enable

Whether to enable cabal-fmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.cabal-fmt.package

cabal-fmt derivation to use.

Type: package

Default: pkgs.haskellPackages.cabal-fmt

Declared by:

perSystem.treefmt.programs.clang-format.enable

Whether to enable clang-format.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.clang-format.package

The clang-tools package to use.

Type: package

Default: pkgs.clang-tools

Declared by:

perSystem.treefmt.programs.cljfmt.enable

Whether to enable cljfmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.cljfmt.package

The cljfmt package to use.

Type: package

Default: pkgs.cljfmt

Declared by:

perSystem.treefmt.programs.cljfmt.includes

Clojure file patterns to format

Type: list of string

Default:

[
  "*.clj"
  "*.cljc"
  "*.cljs"
  "*.cljx"
]

Declared by:

perSystem.treefmt.programs.csharpier.enable

Whether to enable csharpier.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.csharpier.package

The csharpier package to use.

Type: package

Default: pkgs.csharpier

Declared by:

perSystem.treefmt.programs.csharpier.dotnet-sdk

The dotnet-sdk package to use.

Type: package

Default: pkgs.dotnet-sdk

Declared by:

perSystem.treefmt.programs.csharpier.excludes

Path / file patterns to exclude for CSharpier

Type: list of string

Default: [ ]

Declared by:

perSystem.treefmt.programs.csharpier.includes

Path / file patterns to include for CSharpier

Type: list of string

Default:

[
  "*.cs"
]

Declared by:

perSystem.treefmt.programs.cue.enable

Whether to enable cue.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.cue.package

The cue package to use.

Type: package

Default: pkgs.cue

Declared by:

perSystem.treefmt.programs.deadnix.enable

Whether to enable deadnix.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.deadnix.package

The deadnix package to use.

Type: package

Default: pkgs.deadnix

Declared by:

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

Whether to enable Don’t check lambda parameter arguments.

Type: boolean

Default: false

Example: true

Declared by:

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:

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:

perSystem.treefmt.programs.deno.enable

Whether to enable deno.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.deno.package

deno derivation to use.

Type: package

Default: pkgs.deno

Declared by:

perSystem.treefmt.programs.deno.excludes

Path / file patterns to exclude for Deno

Type: list of string

Default: [ ]

Declared by:

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:

perSystem.treefmt.programs.dhall.enable

Whether to enable Dhall.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.dhall.package

The Dhall package to use.

Type: package

Default: pkgs.dhall

Declared by:

perSystem.treefmt.programs.dhall.lint

Whether to lint in addition to formatting.

Type: boolean

Default: false

Declared by:

perSystem.treefmt.programs.dos2unix.enable

Whether to enable dos2unix.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.dos2unix.package

The dos2unix package to use.

Type: package

Default: pkgs.dos2unix

Declared by:

perSystem.treefmt.programs.dprint.enable

Whether to enable dprint.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.dprint.package

The dprint package to use.

Type: package

Default: pkgs.dprint

Declared by:

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:

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:

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:

perSystem.treefmt.programs.dprint.settings.incremental

Whether to format files only when they change.

Type: null or boolean

Default: null

Example: true

Declared by:

perSystem.treefmt.programs.dprint.settings.indentWidth

The number of characters for an indent

Type: null or signed integer

Default: null

Example: 2

Declared by:

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:

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:

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:

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:

perSystem.treefmt.programs.elm-format.enable

Whether to enable elm-format.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.elm-format.package

elm-format derivation to use.

Type: package

Default: pkgs.elmPackages.elm-format

Declared by:

perSystem.treefmt.programs.elm-format.includes

Path / file patterns to include for Biome

Type: list of string

Default:

[
  "*.elm"
]

Example:

[
  "*.elm"
]

Declared by:

perSystem.treefmt.programs.erlfmt.enable

Whether to enable erlfmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.erlfmt.package

The erlfmt package to use.

Type: package

Default: pkgs.erlfmt

Declared by:

perSystem.treefmt.programs.erlfmt.print-width

The line length that formatter would wrap on

Type: signed integer

Default: 100

Example: 80

Declared by:

perSystem.treefmt.programs.fantomas.enable

Whether to enable fantomas.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.fantomas.package

The fantomas package to use.

Type: package

Default: pkgs.fantomas

Declared by:

perSystem.treefmt.programs.fantomas.dotnet-sdk

The dotnet-sdk package to use.

Type: package

Default: pkgs.dotnet-sdk

Declared by:

perSystem.treefmt.programs.fnlfmt.enable

Whether to enable fnlfmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.fnlfmt.package

The fnlfmt package to use.

Type: package

Default: pkgs.fnlfmt

Declared by:

perSystem.treefmt.programs.formatjson5.enable

Whether to enable formatjson5.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.formatjson5.package

The formatjson5 package to use.

Type: package

Default: pkgs.formatjson5

Declared by:

perSystem.treefmt.programs.formatjson5.indent

Indent by the given number of spaces

Type: signed integer

Default: 4

Declared by:

perSystem.treefmt.programs.formatjson5.noTrailingCommas

Suppress trailing commas (otherwise added by default)

Type: boolean

Default: false

Declared by:

perSystem.treefmt.programs.formatjson5.oneElementLines

Objects or arrays with a single child should collapse to a single line

Type: boolean

Default: false

Declared by:

perSystem.treefmt.programs.formatjson5.sortArrays

Sort arrays of primitive values (string, number, boolean, or null) lexicographically

Type: boolean

Default: false

Declared by:

perSystem.treefmt.programs.fourmolu.enable

Whether to enable fourmolu.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.fourmolu.package

fourmolu derivation to use.

Type: package

Default: pkgs.haskellPackages.fourmolu

Declared by:

perSystem.treefmt.programs.fourmolu.ghcOpts

Which GHC language extensions to enable

Type: unspecified value

Default:

[
  "BangPatterns"
  "PatternSynonyms"
  "TypeApplications"
]

Declared by:

perSystem.treefmt.programs.fprettify.enable

Whether to enable fprettify.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.fprettify.package

The fprettify package to use.

Type: package

Default: pkgs.fprettify

Declared by:

perSystem.treefmt.programs.gdformat.enable

Whether to enable gdformat.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.gdformat.package

The gdtoolkit package to use.

Type: package

Default: pkgs.gdtoolkit

Declared by:

perSystem.treefmt.programs.gofmt.enable

Whether to enable gofmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.gofmt.package

The go package to use.

Type: package

Default: pkgs.go

Declared by:

perSystem.treefmt.programs.gofumpt.enable

Whether to enable gofumpt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.gofumpt.package

The gofumpt package to use.

Type: package

Default: pkgs.gofumpt

Declared by:

perSystem.treefmt.programs.gofumpt.extra

Whether to enable extra rules.

Type: boolean

Default: false

Declared by:

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

Whether to enable google-java-format.

Type: boolean

Default: false

Example: true

Declared by:

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

The google-java-format package to use.

Type: package

Default: pkgs.google-java-format

Declared by:

perSystem.treefmt.programs.hclfmt.enable

Whether to enable hclfmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.hclfmt.package

The hclfmt package to use.

Type: package

Default: pkgs.hclfmt

Declared by:

perSystem.treefmt.programs.hlint.enable

Whether to enable hlint.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.hlint.package

The hlint package to use.

Type: package

Default: pkgs.hlint

Declared by:

perSystem.treefmt.programs.isort.enable

Whether to enable isort.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.isort.package

The isort package to use.

Type: package

Default: pkgs.isort

Declared by:

perSystem.treefmt.programs.isort.profile

The profile to use for isort.

Type: string

Default: ""

Declared by:

perSystem.treefmt.programs.jsonfmt.enable

Whether to enable jsonfmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.jsonfmt.package

The jsonfmt package to use.

Type: package

Default: pkgs.jsonfmt

Declared by:

perSystem.treefmt.programs.jsonnet-lint.enable

Whether to enable jsonnet.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.jsonnet-lint.package

The go-jsonnet package to use.

Type: package

Default: pkgs.go-jsonnet

Declared by:

perSystem.treefmt.programs.jsonnetfmt.enable

Whether to enable jsonnet.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.jsonnetfmt.package

The go-jsonnet package to use.

Type: package

Default: pkgs.go-jsonnet

Declared by:

perSystem.treefmt.programs.just.enable

Whether to enable just.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.just.package

The just package to use.

Type: package

Default: pkgs.just

Declared by:

perSystem.treefmt.programs.keep-sorted.enable

Whether to enable keep-sorted.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.keep-sorted.package

The keep-sorted package to use.

Type: package

Default: pkgs.keep-sorted

Declared by:

perSystem.treefmt.programs.ktfmt.enable

Whether to enable ktfmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.ktfmt.package

The ktfmt package to use.

Type: package

Default: pkgs.ktfmt

Declared by:

perSystem.treefmt.programs.ktlint.enable

Whether to enable ktlint.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.ktlint.package

The ktlint package to use.

Type: package

Default: pkgs.ktlint

Declared by:

perSystem.treefmt.programs.leptosfmt.enable

Whether to enable leptosfmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.leptosfmt.package

The leptosfmt package to use.

Type: package

Default: pkgs.leptosfmt

Declared by:

perSystem.treefmt.programs.mdformat.enable

Whether to enable mdformat.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.mdformat.package

The mdformat package to use.

Type: package

Default: pkgs.python3Packages.mdformat

Declared by:

perSystem.treefmt.programs.mdsh.enable

Whether to enable mdsh.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.mdsh.package

The mdsh package to use.

Type: package

Default: pkgs.mdsh

Declared by:

perSystem.treefmt.programs.mix-format.enable

Whether to enable mix-format.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.mix-format.package

The elixir package to use.

Type: package

Default: pkgs.elixir

Declared by:

perSystem.treefmt.programs.muon.enable

Whether to enable muon.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.muon.package

The muon package to use.

Type: package

Default: pkgs.muon

Declared by:

perSystem.treefmt.programs.mypy.enable

Whether to enable mypy.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.mypy.directories

Directories to run mypy in

Type: attribute set of (submodule)

Default:

{
  "." = { };
}

Example:

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

Declared by:

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

Directory to run mypy in

Type: string

Default: "‹name›"

Declared by:

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:

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

Single files to check. Can be globs

Type: list of string

Default: [ ]

Example:

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

Declared by:

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

Modules to check

Type: list of string

Default:

[
  "."
]

Example:

[
  "mymodule"
  "tests"
]

Declared by:

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

Options to pass to mypy

Type: list of string

Default: [ ]

Example:

[
  "--ignore-missing-imports"
]

Declared by:

perSystem.treefmt.programs.nickel.enable

Whether to enable nickel.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.nickel.package

The nickel package to use.

Type: package

Default: pkgs.nickel

Declared by:

perSystem.treefmt.programs.nimpretty.enable

Whether to enable nimpretty.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.nimpretty.package

The nim package to use.

Type: package

Default: pkgs.nim

Declared by:

perSystem.treefmt.programs.nixfmt.enable

Whether to enable nixfmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.nixfmt.package

The nixfmt package to use.

Type: package

Default: pkgs.nixfmt

Declared by:

perSystem.treefmt.programs.nixfmt-rfc-style.enable

Whether to enable nixfmt-rfc-style.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.nixfmt-rfc-style.package

The nixfmt-rfc-style package to use.

Type: package

Default: pkgs.nixfmt-rfc-style

Declared by:

perSystem.treefmt.programs.nixpkgs-fmt.enable

Whether to enable nixpkgs-fmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.nixpkgs-fmt.package

The nixpkgs-fmt package to use.

Type: package

Default: pkgs.nixpkgs-fmt

Declared by:

perSystem.treefmt.programs.ocamlformat.enable

Whether to enable ocamlformat.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.ocamlformat.package

The ocamlformat package to use.

Type: package

Default: pkgs.ocamlformat

Declared by:

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:

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:

perSystem.treefmt.programs.opa.enable

Whether to enable opa.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.opa.package

The open-policy-agent package to use.

Type: package

Default: pkgs.open-policy-agent

Declared by:

perSystem.treefmt.programs.ormolu.enable

Whether to enable ormolu.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.ormolu.package

The ormolu package to use.

Type: package

Default: pkgs.ormolu

Declared by:

perSystem.treefmt.programs.ormolu.ghcOpts

Which GHC language extensions to enable

Type: unspecified value

Default:

[
  "BangPatterns"
  "PatternSynonyms"
  "TypeApplications"
]

Declared by:

perSystem.treefmt.programs.packer.enable

Whether to enable packer.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.packer.package

The packer package to use.

Type: package

Default: pkgs.packer

Declared by:

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

Whether to enable php-cs-fixer.

Type: boolean

Default: false

Example: true

Declared by:

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

The php-cs-fixer package to use.

Type: package

Default: pkgs.php-cs-fixer

Declared by:

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

Path to php-cs-fixer config file.

Type: string or path

Default: "./.php-cs-fixer.php"

Example: "./.php-cs-fixer.dist.php"

Declared by:

perSystem.treefmt.programs.prettier.enable

Whether to enable prettier.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.prettier.package

prettier derivation to use.

Type: package

Default: pkgs.nodePackages.prettier

Declared by:

perSystem.treefmt.programs.prettier.excludes

Path / file patterns to exclude for Prettier

Type: list of string

Default: [ ]

Declared by:

perSystem.treefmt.programs.prettier.includes

Path / file patterns to include for Prettier

Type: list of string

Default:

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

Declared by:

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:

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:

perSystem.treefmt.programs.prettier.settings.bracketSpacing

Print spaces between brackets

Type: null or boolean

Default: null

Example: true

Declared by:

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:

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:

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:

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:

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:

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:

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:

perSystem.treefmt.programs.prettier.settings.jsxSingleQuote

Use single quotes in JSX

Type: null or boolean

Default: null

Example: false

Declared by:

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:

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:

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:

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:

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:

perSystem.treefmt.programs.prettier.settings.proseWrap

How to wrap prose.

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

Default: null

Example: "preserve"

Declared by:

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:

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:

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:

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:

perSystem.treefmt.programs.prettier.settings.semi

Print semicolons.

Type: null or boolean

Default: null

Example: false

Declared by:

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:

perSystem.treefmt.programs.prettier.settings.singleQuote

Use single quotes instead of double quotes.

Type: null or boolean

Default: null

Example: false

Declared by:

perSystem.treefmt.programs.prettier.settings.tabWidth

Number of spaces per indentation level.

Type: null or signed integer

Default: null

Example: 2

Declared by:

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:

perSystem.treefmt.programs.prettier.settings.useTabs

Indent with tabs instead of spaces

Type: null or boolean

Default: null

Example: false

Declared by:

perSystem.treefmt.programs.prettier.settings.vueIndentScriptAndStyle

Indent script and style tags in Vue files.

Type: null or boolean

Default: null

Example: false

Declared by:

perSystem.treefmt.programs.protolint.enable

Whether to enable protolint.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.protolint.package

The protolint package to use.

Type: package

Default: pkgs.protolint

Declared by:

perSystem.treefmt.programs.purs-tidy.enable

Whether to enable purs-tidy.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.purs-tidy.package

purs-tidy derivation to use.

Type: package

Default: pkgs.nodePackages.purs-tidy

Declared by:

perSystem.treefmt.programs.ruff.package

The ruff package to use.

Type: package

Default: pkgs.ruff

Declared by:

perSystem.treefmt.programs.ruff.check

Whether to enable the Ruff linter, an extremely fast Python linter designed as a drop-in replacement for Flake8 (plus dozens of plugins), isort, pydocstyle, pyupgrade, autoflake, and more.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.ruff.format

Whether to enable the Ruff formatter, an extremely fast Python code formatter designed as a drop-in replacement for Black.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.rufo.enable

Whether to enable rufo.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.rufo.package

The rufo package to use.

Type: package

Default: pkgs.rufo

Declared by:

perSystem.treefmt.programs.rustfmt.enable

Whether to enable rustfmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.rustfmt.package

The rustfmt package to use.

Type: package

Default: pkgs.rustfmt

Declared by:

perSystem.treefmt.programs.rustfmt.edition

Rust edition to target when formatting

Type: string

Default: "2021"

Declared by:

perSystem.treefmt.programs.scalafmt.enable

Whether to enable scalafmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.scalafmt.package

The scalafmt package to use.

Type: package

Default: pkgs.scalafmt

Declared by:

perSystem.treefmt.programs.shellcheck.enable

Whether to enable shellcheck.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.shellcheck.package

The shellcheck package to use.

Type: package

Default: pkgs.shellcheck

Declared by:

perSystem.treefmt.programs.shfmt.enable

Whether to enable shfmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.shfmt.package

The shfmt package to use.

Type: package

Default: pkgs.shfmt

Declared by:

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:

perSystem.treefmt.programs.statix.enable

Whether to enable statix.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.statix.package

The statix package to use.

Type: package

Default: pkgs.statix

Declared by:

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:

perSystem.treefmt.programs.stylish-haskell.enable

Whether to enable stylish-haskell.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.stylish-haskell.package

The stylish-haskell package to use.

Type: package

Default: pkgs.stylish-haskell

Declared by:

perSystem.treefmt.programs.stylua.enable

Whether to enable stylua.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.stylua.package

The stylua package to use.

Type: package

Default: pkgs.stylua

Declared by:

perSystem.treefmt.programs.swift-format.enable

Whether to enable swift-format.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.swift-format.package

The swift-format package to use.

Type: package

Default: pkgs.swift-format

Declared by:

perSystem.treefmt.programs.taplo.enable

Whether to enable taplo.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.taplo.package

The taplo package to use.

Type: package

Default: pkgs.taplo

Declared by:

perSystem.treefmt.programs.templ.enable

Whether to enable templ.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.templ.package

The templ package to use.

Type: package

Default: pkgs.templ

Declared by:

perSystem.treefmt.programs.terraform.enable

Whether to enable terraform.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.terraform.package

The terraform package to use.

Type: package

Default: pkgs.terraform

Declared by:

perSystem.treefmt.programs.typstfmt.enable

Whether to enable typstfmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.typstfmt.package

The typstfmt package to use.

Type: package

Default: pkgs.typstfmt

Declared by:

perSystem.treefmt.programs.yamlfmt.enable

Whether to enable yamlfmt.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.yamlfmt.package

The yamlfmt package to use.

Type: package

Default: pkgs.yamlfmt

Declared by:

perSystem.treefmt.programs.zig.enable

Whether to enable zig.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.zig.package

The zig package to use.

Type: package

Default: pkgs.zig

Declared by:

perSystem.treefmt.programs.zprint.enable

Whether to enable zprint.

Type: boolean

Default: false

Example: true

Declared by:

perSystem.treefmt.programs.zprint.package

zprint derivation to use.

Type: package

Default: pkgs.zprint

Declared by:

perSystem.treefmt.programs.zprint.zprintOpts

Clojure map containing zprint options.

Type: null or string

Default: null

Example: "{:width 90}"

Declared by:

perSystem.treefmt.projectRoot

Path to the root of the project on which treefmt operates

Type: path

Default: self

Declared by:

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:

perSystem.treefmt.settings.formatter

Set of formatters to use

Type: attribute set of (submodule)

Default: { }

Declared by:

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

Executable obeying the treefmt formatter spec

Type: Path to executable

Declared by:

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:

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

List of files to include for formatting. Supports globbing.

Type: list of string

Declared by:

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

List of arguments to pass to the command

Type: list of string

Default: [ ]

Declared by:

perSystem.treefmt.settings.global.excludes

A global list of paths to exclude. Supports glob.

Type: list of string

Default: [ ]

Example:

[
  "./node_modules/**"
]

Declared by: