nixfmt: An opinionated formatter for Nix

[ development, library, mpl ] [ Propose Tags ]

A formatter for Nix that ensures consistent and clear formatting by forgetting all existing formatting during parsing.

[Skip to Readme]
Versions [faq] 0.3.0
Change log
Dependencies base (>=4.12.0 && <4.13), cmdargs (>=0.10.20 && <0.11), directory (>=1.3.3 && <1.4), filepath (>=1.4.2 && <1.5), ghcjs-base (>=0.2.0 && <0.3), megaparsec (>=7.0.5 && <7.1), nixfmt, parser-combinators (>=1.0.3 && <1.3), safe-exceptions (>=0.1.7 && <0.2), text (>=1.2.3 && <1.3), unix (>=2.7.2 && <2.8) [details]
License MPL-2.0
Copyright 2019 Serokell, 2019 Lars Jellema
Author Lars Jellema
Category Development
Home page
Bug tracker
Source repo head: git clone git://
Uploaded by LarsJellema at Thu Aug 29 12:53:31 UTC 2019
Distributions NixOS:0.3.0
Executables js-interface, nixfmt
Downloads 40 total (15 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-08-29 [all 1 reports]


[Index] [Quick Jump]


Maintainer's Corner

For package maintainers and hackage trustees

Readme for nixfmt-0.3.0

[back to package description]
<!-- © 2019 Serokell <> - © 2019 Lars Jellema <> - - SPDX-License-Identifier: MPL-2.0 -->


nixfmt is a formatter for Nix code, intended to easily apply a uniform style.

You are encouraged to test this out on your code and submit any undesirable formatting you find as an issue

Build Status Cachix


  • Optional: cachix use nixfmt
  • nix-env -f -i


With Nix

Haskell dependencies will be built by Nix.

  • Enter nix-shell
  • Build with cabal new-build

Without Nix

Haskell dependencies will be bulit by Cabal.

  • Build with cabal new-build


  • nixfmt < input.nix – reads Nix code form stdin, formats it, and outputs to stdout
  • nixfmt file.nix – format the file in place

For Contributors

We welcome issues and pull requests on GitHub.

About Serokell

nixfmt is maintained and funded with :heart: by Serokell. The names and logo for Serokell are trademark of Serokell OÜ.

We love open source software! See our other projects or hire us to design, develop and grow your idea!