mirror of
https://github.com/NixOS/nix.git
synced 2025-04-15 13:47:34 +00:00
Merge 94782f07c6
into 0e1323c041
This commit is contained in:
commit
63ac7843e3
@ -9,39 +9,19 @@ 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.
|
||||
|
||||
|
||||
# Examples
|
||||
# Example
|
||||
|
||||
With [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt):
|
||||
To use the [official Nix formatter](https://github.com/NixOS/nixfmt):
|
||||
|
||||
```nix
|
||||
# flake.nix
|
||||
{
|
||||
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;
|
||||
};
|
||||
}
|
||||
```
|
||||
See https://nix.dev/guides/recipes/autoformatting.html for more details.
|
||||
|
||||
)""
|
||||
|
Loading…
Reference in New Issue
Block a user