treefmt nix configuration
This repo is for users that use both Nix and treefmt.
It contains a mapping from programs to treefmt.toml
formatter entries,
maintained by the community.
Quick Usage
This returns a treefmt
instance with terraform configured to format *.tf
files:
{ nixpkgs, treefmt-nix, ... }:
treefmt-nix.lib.mkWrapper nixpkgs {
# Used to find the project root
projectRootFile = ".git/config";
# Enable the terraform formatter
programs.terraform.enable = true;
# Override the default package
programs.terraform.package = nixpkgs.terraform_1_0;
# Override the default settings generated by the above option
settings.formatter.terraform.excludes = ["hello.tf"];
}
Supported programs
- alejandra
- black
- cabal-fmt
- elm-format
- gofmt
- gofumpt
- nixpkgs-fmt
- ormolu
- prettier
- rufo
- rustfmt
- shellcheck
- shfmt
- stylua
- terraform
License
MIT