Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 3 additions & 25 deletions src/nix/fmt.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


# 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;
};
}
```

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;
formatter.x86_64-linux = nixpkgs.legacyPackages.${system}.nixfmt-tree;
};
}
```
Expand Down
Loading