From 29f062e10da35091ff49f105a7d6ad1b7970266b Mon Sep 17 00:00:00 2001 From: Joe DeVivo Date: Fri, 22 Mar 2024 09:15:56 -0700 Subject: [PATCH] Added `args` and `exclude_types` to hook type --- modules/hook.nix | 19 ++++++++++++++++++- modules/hooks.nix | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/hook.nix b/modules/hook.nix index 3c353e46..1bb11b7d 100644 --- a/modules/hook.nix +++ b/modules/hook.nix @@ -130,6 +130,15 @@ in default = [ ]; }; + exclude_types = mkOption { + type = types.listOf types.str; + description = lib.mdDoc + '' + List of file types to exclude. See [Filtering files with types](https://pre-commit.com/#plugins). + ''; + default = [ ]; + }; + pass_filenames = mkOption { type = types.bool; description = lib.mdDoc '' @@ -178,12 +187,20 @@ in if true this hook will run even if there are no matching files. ''; }; + + args = mkOption { + type = types.listOf types.str; + description = lib.mdDoc '' + List of additional parameters to pass to the hook. + ''; + default = [ ]; + }; }; config = { raw = { - inherit (config) name entry language files types types_or pass_filenames fail_fast require_serial stages verbose always_run; + inherit (config) name entry language files types types_or exclude_types pass_filenames fail_fast require_serial stages verbose always_run args; id = config.name; exclude = mergeExcludes config.excludes; }; diff --git a/modules/hooks.nix b/modules/hooks.nix index 70b99009..97233937 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -2738,7 +2738,8 @@ in description = "Format shell files."; types = [ "shell" ]; package = tools.shfmt; - entry = "${hooks.shfmt.package}/bin/shfmt -w -s -l"; + entry = "${hooks.shfmt.package}/bin/shfmt -w -l"; + args = [ "-s" ]; }; staticcheck = {