{"repo":"NixOS/nixfmt","free":true,"listed":false,"github":"https://github.com/NixOS/nixfmt","clone":"git clone https://github.com/NixOS/nixfmt.git","description":"The official formatter for Nix code","language":"Haskell","stars":1586,"topics":["nix","formatter","haskell"],"license":"MPL-2.0","category":"dev-tools","readme_excerpt":"Nixfmt Nixfmt is the official formatter for Nix language code. The standard Nix format incorporates artistic formatting and is defined in standard.md. Nixfmt is maintained by the Nix formatting team. This document is the user documentation, see CONTRIBUTING.md for contributor documentation. Installation [!NOTE] nixfmt can only process one file at a time. Consider using a configuration helper for formatting a project. In the environment NixOS To install nixfmt on NixOS for all users, add it to the environment.systemPackages configuration option: To install it on NixOS for a particular user, add it to the users.users. .packages configuration option: Home Manager To install nixfmt in Home Manager, add it to the home.packages configuration option: Declarative shell environment To make nixfmt available in a shell environment invoked with nix-shell , add it to the packages argument of mkShell : In an editor neovim + nixd [!NOTE] This only works when nixfmt is available in the environment. neovim + nil [!NOTE] This only works when nixfmt is available in the environment. neovim + none-ls [!NOTE] This only works when nixfmt is available in the environment. Visual Studio Code (VSC) vscode-nix-ide can invoke nixfmt . [!NOTE] This only works when nixfmt is available in the environment. In a project nixfmt-tree nixfmt-tree provides an instance of treefmt , pre-configured to use nixfmt. Simply add it to your shell: Then run treefmt from within your shell to format all nix files in your pro","default_branch":null,"files":null,"tree":[],"storefront":"/r/NixOS","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/NixOS/nixfmt/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}