nixfmt: An opinionated formatter for Nix

[ development, library, mpl ] [ Propose Tags ] [ Report a vulnerability ]

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


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.3.0, 0.4.0, 0.5.0, 0.6.0
Change log CHANGELOG.md
Dependencies base (>=4.12.0 && <4.19), 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 (>=9.0.1 && <9.6), nixfmt, parser-combinators (>=1.0.3 && <1.4), safe-exceptions (>=0.1.7 && <0.2), scientific (>=0.3.0 && <0.4.0), text (>=1.2.3 && <2.2), unix (>=2.7.2 && <2.9) [details]
License MPL-2.0
Copyright 2022 Serokell, 2022 Lars Jellema
Author Lars Jellema
Maintainer lars.jellema@gmail.com
Category Development
Home page https://github.com/serokell/nixfmt
Bug tracker https://github.com/serokell/nixfmt/issues
Source repo head: git clone git://github.com/serokell/nixfmt.git
Uploaded by infinisil at 2023-10-31T21:53:32Z
Distributions NixOS:0.6.0
Executables js-interface, nixfmt
Downloads 1317 total (22 in the last 30 days)
Rating 1.75 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for nixfmt-0.6.0

[back to package description]

nixfmt

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

Installation

  • nixfmt is in nixpkgs master as of 2019-09-04:

    nix-env -iA nixpkgs.nixfmt
    
  • To get the most recent version, install from master:

    nix-env -f https://github.com/serokell/nixfmt/archive/master.tar.gz -i
    
  • Nix with flakes

    nix profile install github:serokell/nixfmt
    

Development

With Nix

Haskell dependencies will be built by Nix.

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

Without Nix

Haskell dependencies will be built by Cabal.

  • Build with cabal new-build

Usage

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

About Serokell

nixfmt is maintained and funded with ❤️ 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!