nixfmt
nixfmt copied to clipboard
The official (but not yet stable) formatter for Nix code
Input (note that every line starts with a single tab character): ```nix '' foo bar '' ``` Expected output: ```nix '' foo bar '' ``` Actual output: ```nix " foo\n...
### Description I'm using Neovim with the following setup ```lua local nvim_lsp = require("lspconfig") nvim_lsp.nixd.setup({ cmd = { "nixd" }, settings = { nixd = { formatting = { command...
https://github.com/NixOS/nixpkgs/pull/324192#discussion_r1663384565 The synopsis now matches the repo description
I honestly don't understand why this makes it faster, but for me the test suite runs ~2s faster now. This is an AI-generated contribution. The GPT explanation is: By abstracting...
It seems that we are only using a single thread when formatting tons of files. But this can be trivially parallelized. This should also ease the adoption of format-checking in...
Makes it easier to override or, hopefully in the future, make configurable (weird you can configure the line length, but not indentation width). Personally I find 2-space-indented code very difficult...
### Description `/* */` style comments should not be reformatted. They have additional use cases such as tree-sitter picking up the the syntax to highlight before scripts inside multiline strings....
### Description "[Absorption](https://github.com/NixOS/rfcs/blob/master/rfcs/0166-nix-formatting.md#terms-and-definitions)" is an "an alternative layout" that reduces indentation level, according to NixOS/rfcs#166. That is, the specification allows such "alternative" alongside the indent-after-newline right-hand-side style. Given a chain...
### Description A particular attrset item I have in a NixOS configuration is formatted quite oddly, while the surrounding similar lines are not. ### Small example input ```nix { systemd.services."systemd-homed".serviceConfig.WatchdogSec...
### Description Related: #153 I'm trying to apply RFC 166 style on [rust-overlay](https://github.com/oxalica/rust-overlay) and noticed this weird formatting. ### Small example input ```nix { rust-channel-of-version = assertEq (rustChannelOf { channel...