Skip to content

Commit 6f71d8a

Browse files
jflyMic92
authored andcommitted
Update nix fmt man page with official formatter example
The current example relies upon [nixfmt's deprecated tree traversal behavior](NixOS/nixfmt#240). The simplest alternative is the new `nixfmt-tree` wrapper for `nixfmt`/`treefmt`.
1 parent 143fb88 commit 6f71d8a

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)