Skip to content

Commit

Permalink
Add custom hook example to hook option doc
Browse files Browse the repository at this point in the history
  • Loading branch information
roberth committed May 15, 2023
1 parent fb58866 commit 10a4aed
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions modules/pre-commit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,27 @@ in
''
The hook definitions.
Pre-defined hooks can be enabled by, for example:
You can both specify your own hooks here and you can enable predefined hooks.
Example of enabling a predefined hook:
```nix
hooks.nixpkgs-fmt.enable = true;
```
The pre-defined hooks are:
Example of a custom hook:
```nix
hooks.my-tool = {
enable = true;
name = "my-tool";
description = "Run MyTool on all files in the project";
files = "\\.mtl$";
entry = "${pkgs.my-tool}/bin/mytoolctl";
};
```
The predefined hooks are:
${
lib.concatStringsSep
Expand Down

0 comments on commit 10a4aed

Please sign in to comment.