Skip to content
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ use nix
- [end-of-file-fixer](https://github.com/pre-commit/pre-commit-hooks/blob/main/pre_commit_hooks/end_of_file_fixer.py)
- [fix-byte-order-marker](https://github.com/pre-commit/pre-commit-hooks/blob/main/pre_commit_hooks/fix_byte_order_marker.py)
- [headache](https://github.com/frama-c/headache)
- [hledger-fmt](https://github.com/mondeja/hledger-fmt)
- [mixed-line-endings](https://github.com/pre-commit/pre-commit-hooks/blob/main/pre_commit_hooks/mixed_line_ending.py)
- [mkdocs-linkcheck](https://github.com/byrnereese/linkchecker-mkdocs)
- [openapi-spec-validator](https://github.com/python-openapi/openapi-spec-validator)
Expand Down
30 changes: 30 additions & 0 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,20 @@ in
};
};
};
hledger-fmt = mkOption {
description = "hledger-fmt hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
fix =
mkOption {
type = types.bool;
description = "Fix the files in place.";
default = false;
};
};
};
};
hlint = mkOption {
description = "hlint hook";
type = types.submodule {
Expand Down Expand Up @@ -3083,6 +3097,22 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm
entry = "${hooks.hindent.package}/bin/hindent";
files = "\\.l?hs(-boot)?$";
};
hledger-fmt =
{
name = "hledger-fmt";
description = "Opinionated hledger's journal files formatter.";
package = tools.hledger-fmt;
entry =
let
cmdArgs = mkCmdArgs (
with hooks.hledger-fmt.settings; [
[ fix "--fix" ]
]
);
in
"${hooks.hledger-fmt.package}/bin/hledger-fmt ${cmdArgs}";
files = "\\.(hledger|journal|j)$";
};
hlint =
{
name = "hlint";
Expand Down
2 changes: 2 additions & 0 deletions nix/tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
, hadolint
, haskellPackages
, hindent
, hledger-fmt ? null
, hlint
, hpack
, html-tidy
Expand Down Expand Up @@ -147,6 +148,7 @@ in
gptcommit
hadolint
hindent
hledger-fmt
hlint
hpack
html-tidy
Expand Down