Skip to content

Commit c39a7a5

Browse files
committed
docs: use nixfmt in readme
1 parent d392301 commit c39a7a5

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,34 @@
2222
2323
{
2424
git-hooks.hooks = {
25-
# lint shell scripts
25+
# Format Nix code
26+
nixfmt.enable = true;
27+
28+
# Format Python code
29+
black.enable = true;
30+
31+
# Lint shell scripts
2632
shellcheck.enable = true;
27-
# execute example shell from Markdown files
33+
34+
# Execute shell examples in Markdown files
2835
mdsh.enable = true;
29-
# format Python code
30-
black.enable = true;
3136
32-
# override a package with a different version
37+
# Override a package with a different version
3338
ormolu.enable = true;
3439
ormolu.package = pkgs.haskellPackages.ormolu;
3540
36-
# some hooks have more than one package, like clippy:
41+
# Some hooks have more than one package, like clippy:
3742
clippy.enable = true;
3843
clippy.packageOverrides.cargo = pkgs.cargo;
3944
clippy.packageOverrides.clippy = pkgs.clippy;
40-
# some hooks provide settings
45+
# Some hooks provide settings
4146
clippy.settings.allFeatures = true;
47+
48+
# Define your own custom hooks
49+
my-custom-hook = {
50+
name = "My own hook";
51+
exec = "on-pre-commit.sh";
52+
};
4253
};
4354
}
4455
```
@@ -89,7 +100,7 @@ Given the following `flake.nix` example:
89100
pre-commit-check = inputs.git-hooks.lib.${system}.run {
90101
src = ./.;
91102
hooks = {
92-
nixfmt-rfc-style.enable = true;
103+
nixfmt.enable = true;
93104
};
94105
};
95106
});
@@ -371,6 +382,7 @@ use nix
371382
- [deadnix](https://github.com/astro/deadnix)
372383
- [flake-checker](https://github.com/DeterminateSystems/flake-checker)
373384
- [nil](https://github.com/oxalica/nil)
385+
- [nixfmt](https://github.com/NixOS/nixfmt/) (supports `nixfmt` >=v1.0)
374386
- [nixfmt-classic](https://github.com/NixOS/nixfmt/tree/v0.6.0)
375387
- [nixfmt-rfc-style](https://github.com/NixOS/nixfmt/)
376388
- [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt)

0 commit comments

Comments
 (0)