Skip to content

Commit cf5087d

Browse files
author
David Arnold
committed
feat: support specifying stages, close #49
1 parent 16d4ca0 commit cf5087d

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

modules/pre-commit.nix

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,18 @@ in
258258
default = [];
259259
};
260260

261+
default_stages =
262+
mkOption {
263+
type = types.listOf types.str;
264+
description =
265+
''
266+
A configuration wide option for the stages property.
267+
Installs hooks to the defined stages.
268+
Default is empty which falls back to 'commit'.
269+
'';
270+
default = [];
271+
};
272+
261273
rawConfig =
262274
mkOption {
263275
type = types.attrs;
@@ -284,8 +296,11 @@ in
284296
hooks = processedHooks;
285297
}
286298
];
299+
test = "string";
287300
} // lib.optionalAttrs (cfg.excludes != []) {
288301
exclude = mergeExcludes cfg.excludes;
302+
} // lib.optionalAttrs (cfg.default_stages != []) {
303+
default_stages = cfg.default_stages;
289304
};
290305

291306
pre-commit.installationScript =

nix/run.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ builtinStuff@{ pkgs, tools, pre-commit, git, runCommand, writeText, writeScript,
55
, excludes ? []
66
, tools ? {}
77
, settings ? {}
8+
, default_stages ? []
89
}:
910

1011
let
@@ -32,7 +33,7 @@ let
3233
_module.args.pkgs = pkgs;
3334
pre-commit =
3435
{
35-
inherit hooks excludes settings;
36+
inherit hooks excludes settings default_stages;
3637
tools = builtinStuff.tools // tools;
3738
};
3839
};

0 commit comments

Comments
 (0)