Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

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

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Nix
  3. nixfmt

nixfmt

MPL-2.0Haskellv1.4.0

The official formatter for Nix language code, enforcing a standard artistic formatting style.

GitHubGitHub
1.6k stars75 forks0 contributors

What is nixfmt?

Nixfmt is the official code formatter for the Nix language. It automatically formats Nix code to comply with a standard artistic style defined by the Nix community, ensuring consistency across projects. It solves the problem of inconsistent formatting in Nix codebases, making code more readable and maintainable.

Target Audience

Nix developers and teams working on Nix projects who want to enforce a consistent code style automatically. It's particularly useful for collaborative environments where multiple contributors edit Nix files.

Value Proposition

Developers choose Nixfmt because it's the officially maintained formatter for Nix, providing a single source of truth for formatting rules. It integrates seamlessly with popular editors, Git hooks, and project tooling, reducing configuration overhead and ensuring adherence to community standards.

Overview

The official formatter for Nix code

Use Cases

Best For

  • Enforcing consistent code style across Nix projects
  • Automating formatting checks in CI/CD pipelines
  • Integrating formatting into editor workflows for Nix development
  • Setting up pre-commit hooks for Nix repositories
  • Resolving formatting-related merge conflicts in Git
  • Standardizing Nix code in large, collaborative teams

Not Ideal For

  • Projects requiring batch formatting of multiple Nix files without additional tooling like treefmt
  • Teams with established, custom formatting rules that conflict with the official Nix community standard
  • Environments without the Nix package manager installed, as installation and execution depend on Nix

Pros & Cons

Pros

Official Standard Adherence

Maintained by the Nix formatting team, it enforces the community-defined artistic formatting from standard.md, eliminating style debates in collaborative projects.

Seamless Editor Integration

Works with popular editors like neovim (via nixd, nil, none-ls) and VSCode through extensions, making it easy to incorporate into daily workflows.

Advanced Git Tooling

Includes a --mergetool mode for resolving formatting-related conflicts and supports pre-commit hooks via git-hooks.nix or direct configuration, automating checks.

Nix Ecosystem Integration

Easily installable via NixOS, Home Manager, and declarative shells, and integrates with project tools like treefmt-nix and nix fmt for flakes.

Cons

Single-File Limitation

The core tool can only process one file at a time, requiring external wrappers like treefmt for project-wide formatting, as noted in the README.

Nix Dependency Barrier

Installation and use are tied to the Nix package manager, which can be a hurdle for developers not already in the Nix ecosystem or using other OSes.

No Formatting Customization

Formats strictly to the community standard with no built-in options to adjust rules, which may not suit teams preferring different styles.

Frequently Asked Questions

Quick Stats

Stars1,559
Forks75
Contributors0
Open Issues23
Last commit2 days ago
CreatedSince 2018

Tags

#formatting#haskell#developer-tools#pre-commit#code-formatter#editor-integration#nix-language#nix#git-tools#formatter

Included in

Nix5.0k
Auto-fetched 19 hours ago

Related Projects

devenvdevenv

Fast, Declarative, Reproducible, and Composable Developer Environments using Nix

Stars7,163
Forks527
Last commit22 hours ago
nhnh

Yet another Nix CLI helper. [Maintainers=@NotAShelf, @faukah]

Stars3,025
Forks122
Last commit2 days ago
commacomma

Comma runs software without installing it. [maintainers=@Artturin,@burke,@DavHau]

Stars1,725
Forks62
Last commit28 days ago
nix-output-monitornix-output-monitor

Pipe your nix-build output through the nix-output-monitor a.k.a nom to get additional information while building.

Stars1,596
Forks52
Last commit10 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