Skip to content

Commit 9fe3077

Browse files
authored
Merge pull request #13014 from jfly/update-nix_fmt-man-page
Update `nix fmt` man page with official formatter example
2 parents 143fb88 + 6f71d8a commit 9fe3077

File tree

1 file changed

+3
-25
lines changed

1 file changed

+3
-25
lines changed

src/nix/formatter-run.md

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,15 @@ Flags can be forwarded to the formatter by using `--` followed by the flags.
99
Any arguments will be forwarded to the formatter. Typically these are the files to format.
1010

1111

12-
# Examples
12+
# Example
1313

14-
With [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt):
14+
To use the [official Nix formatter](https://github.com/NixOS/nixfmt):
1515

1616
```nix
1717
# flake.nix
1818
{
1919
outputs = { nixpkgs, self }: {
20-
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
21-
};
22-
}
23-
```
24-
25-
With [nixfmt](https://github.com/NixOS/nixfmt):
26-
27-
```nix
28-
# flake.nix
29-
{
30-
outputs = { nixpkgs, self }: {
31-
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
32-
};
33-
}
34-
```
35-
36-
With [Alejandra](https://github.com/kamadorueda/alejandra):
37-
38-
```nix
39-
# flake.nix
40-
{
41-
outputs = { nixpkgs, self }: {
42-
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
20+
formatter.x86_64-linux = nixpkgs.legacyPackages.${system}.nixfmt-tree;
4321
};
4422
}
4523
```

0 commit comments

Comments
 (0)