Skip to content
/ nixfmt Public
forked from NixOS/nixfmt

The soon-to-be official formatter for Nix code

License

Notifications You must be signed in to change notification settings

toastal/nixfmt

 
 

Repository files navigation

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

State

nixfmt will form the basis for the initial official standard Nix formatter, as established by RFC 166.

The established standard Nix formatting differs considerably from the original one. Be aware of this if you track the main branch. Until the first new release the main branch should be considered very unstable.

For more details, see the RFC implementation tracking issue.

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!

About

The soon-to-be official formatter for Nix code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nix 80.4%
  • Haskell 19.4%
  • Shell 0.2%