Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc/nix fmt: Do not document behavior we do not control #11613

Merged
merged 1 commit into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
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
24 changes: 9 additions & 15 deletions src/nix/fmt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
R""(

# Description

`nix fmt` calls the formatter specified in the flake.

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

With [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt):
Expand All @@ -13,10 +22,6 @@ With [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt):
}
```

- Format the current flake: `$ nix fmt`

- Format a specific folder or file: `$ nix fmt ./folder ./file.nix`

With [nixfmt](https://github.com/serokell/nixfmt):

```nix
Expand All @@ -28,8 +33,6 @@ With [nixfmt](https://github.com/serokell/nixfmt):
}
```

- Format specific files: `$ nix fmt ./file1.nix ./file2.nix`

With [Alejandra](https://github.com/kamadorueda/alejandra):

```nix
Expand All @@ -41,13 +44,4 @@ With [Alejandra](https://github.com/kamadorueda/alejandra):
}
```

- Format the current flake: `$ nix fmt`

- Format a specific folder or file: `$ nix fmt ./folder ./file.nix`

# Description

`nix fmt` will rewrite all Nix files (\*.nix) to a canonical format
using the formatter specified in your flake.

)""
2 changes: 1 addition & 1 deletion tests/functional/fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cp ./simple.nix ./simple.builder.sh ./fmt.simple.sh ./config.nix "$TEST_HOME"

cd "$TEST_HOME"

nix fmt --help | grep "Format"
nix fmt --help | grep "forward"

cat << EOF > flake.nix
{
Expand Down
Loading