Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Nix
  3. treefmt-nix

treefmt-nix

MITNix

A Nix library to configure and run treefmt, enabling multi-language code formatting with a single command.

Visit WebsiteGitHubGitHub
638 stars177 forks0 contributors

What is treefmt-nix?

treefmt-nix is a Nix library that configures and runs treefmt, a tool for formatting code across multiple programming languages with a single command. It allows developers to manage formatter dependencies and settings entirely within Nix, providing a reproducible and integrated formatting workflow. The project solves the problem of managing disparate formatter tools and configurations by centralizing them in Nix expressions.

Target Audience

Nix users and developers working in polyglot codebases who want a unified, declarative approach to code formatting. It is particularly useful for teams using Nix development environments or flakes.

Value Proposition

Developers choose treefmt-nix because it deeply integrates with Nix, offering a declarative configuration, automatic formatter installation, and seamless compatibility with Nix development shells and CI/CD pipelines. Its extensive library of pre-configured formatters saves time and ensures consistency.

Overview

treefmt nix configuration

Use Cases

Best For

  • Formatting multi-language projects with a single command
  • Integrating code formatting into Nix development environments
  • Ensuring consistent formatting across CI/CD pipelines
  • Managing formatter dependencies declaratively with Nix
  • Adding custom formatters not covered by standard tools
  • Using Nix flakes for project formatting and validation

Not Ideal For

  • Teams not using Nix in their development workflow
  • Projects requiring quick, ad-hoc formatting without Nix setup overhead
  • Environments where Nix is unsupported, such as some Windows setups without WSL

Pros & Cons

Pros

Deep Nix Integration

Formatters, dependencies, and configurations are managed declaratively in Nix, eliminating separate TOML files and ensuring reproducible builds across environments.

Extensive Formatter Library

Includes over 100 community-maintained formatter configurations for languages like Python, Rust, and Go, reducing setup time and ensuring consistency.

Seamless Dev Environment

Automatically installs and configures formatters, integrating with Nix development shells and flakes for easy setup in polyglot projects.

CI/CD Ready

Works with nix flake check to validate formatting in continuous integration, providing a built-in way to enforce code standards without extra tooling.

Cons

Nix Dependency Lock-in

Requires a Nix environment to function, making it unsuitable for teams not already invested in Nix or in environments where Nix is difficult to deploy.

Configuration Complexity

Setting up involves writing Nix expressions, which can be steep for developers unfamiliar with Nix, and overkill for simple formatting needs.

Limited Formatter Updates

While many formatters are supported, adding new or niche formatters requires manual PRs or custom definitions, and updates may lag behind upstream changes.

Frequently Asked Questions

Quick Stats

Stars638
Forks177
Contributors0
Open Issues52
Last commit5 days ago
CreatedSince 2022

Tags

#multi-language#developer-tools#flake-parts#nix-flakes#buildbot-numtide#ci-cd#nix#code-formatting

Built With

N
Nix

Links & Resources

Website

Included in

Nix5.0k
Auto-fetched 1 day ago

Related Projects

DevboxDevbox

Instant, easy, and predictable development environments

Stars12,289
Forks356
Last commit3 days ago
floxflox

The Deterministic Foundation for your SDLC

Stars4,099
Forks127
Last commit1 day ago
nix-direnvnix-direnv

A fast, persistent use_nix/use_flake implementation for direnv [maintainer=@Mic92 / @bbenne10]

Stars2,760
Forks146
Last commit2 days ago
atticattic

Multi-tenant Nix Binary Cache

Stars2,025
Forks179
Last commit4 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub