From 72bce6365cf2240d2d71bf69d42c506c6f6a8379 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 | 18 ++++++++++++++++++ modules/hooks.nix | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/hook.nix b/modules/hook.nix index 3c353e46..97261187 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,6 +187,14 @@ 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 = { @@ -186,6 +203,7 @@ in inherit (config) name entry language files types types_or pass_filenames fail_fast require_serial stages verbose always_run; id = config.name; exclude = mergeExcludes config.excludes; + inherit exclude_types args; }; }; } 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 = {