1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-08 06:53:54 +02:00

Merge pull request #13014 from jfly/update-nix_fmt-man-page

Update `nix fmt` man page with official formatter example
This commit is contained in:
Jörg Thalheim 2025-05-01 15:11:12 +02:00 committed by GitHub
commit 9fe3077d47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,37 +9,15 @@ Flags can be forwarded to the formatter by using `--` followed by the flags.
Any arguments will be forwarded to the formatter. Typically these are the files to format. Any arguments will be forwarded to the formatter. Typically these are the files to format.
# Examples # Example
With [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt): To use the [official Nix formatter](https://github.com/NixOS/nixfmt):
```nix ```nix
# flake.nix # flake.nix
{ {
outputs = { nixpkgs, self }: { outputs = { nixpkgs, self }: {
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt; formatter.x86_64-linux = nixpkgs.legacyPackages.${system}.nixfmt-tree;
};
}
```
With [nixfmt](https://github.com/NixOS/nixfmt):
```nix
# flake.nix
{
outputs = { nixpkgs, self }: {
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
};
}
```
With [Alejandra](https://github.com/kamadorueda/alejandra):
```nix
# flake.nix
{
outputs = { nixpkgs, self }: {
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
}; };
} }
``` ```