Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/serokell/nixfmt
The official (but not yet stable) formatter for Nix code
https://github.com/serokell/nixfmt
formatter haskell nix
Last synced: 3 months ago
JSON representation
The official (but not yet stable) formatter for Nix code
- Host: GitHub
- URL: https://github.com/serokell/nixfmt
- Owner: NixOS
- License: mpl-2.0
- Created: 2018-08-02T12:33:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-05T22:46:57.000Z (7 months ago)
- Last Synced: 2024-04-15T12:49:40.326Z (7 months ago)
- Topics: formatter, haskell, nix
- Language: Nix
- Homepage: https://nixfmt.serokell.io
- Size: 806 KB
- Stars: 603
- Watchers: 33
- Forks: 23
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nix - nixfmt - A formatter for Nix code, intended to easily apply a uniform style. (Command-Line Tools / Discovery)
README
# `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](https://github.com/NixOS/nixfmt/actions/workflows/main.yml/badge.svg?branch=master)
## State
`nixfmt` will form the basis for the initial official standard Nix formatter, as established by [RFC 166](https://github.com/NixOS/rfcs/pull/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](https://github.com/NixOS/nixfmt/issues/153).
## 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/NixOS/nixfmt/archive/master.tar.gz -i
- Nix with flakes
nix profile install github:NixOS/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 :heart: by
[Serokell](https://serokell.io/). The names and logo for Serokell are trademark
of Serokell OÜ.We love open source software! See
[our other projects](https://serokell.io/community?utm_source=github) or
[hire us](https://serokell.io/hire-us?utm_source=github) to design, develop and
grow your idea!