Skip to content

Commit d1d8fe5

Browse files
authored
Merge pull request #614 from sean-xyz/convco-options
feat(convco): add option configPath
2 parents be0657a + 222d550 commit d1d8fe5

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

modules/hooks.nix

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,20 @@ in
301301
};
302302
};
303303
};
304+
convco = mkOption {
305+
description = "convco hook";
306+
type = types.submodule {
307+
imports = [ hookModule ];
308+
options.settings = {
309+
configPath =
310+
mkOption {
311+
type = types.nullOr (types.oneOf [ types.str types.path ]);
312+
description = "Path to the configuration file (YAML or JSON)";
313+
default = null;
314+
};
315+
};
316+
};
317+
};
304318
credo = mkOption {
305319
description = "credo hook";
306320
type = types.submodule {
@@ -2542,9 +2556,13 @@ in
25422556
package = tools.convco;
25432557
entry =
25442558
let
2559+
cmdArgs =
2560+
mkCmdArgs (with hooks.convco.settings; [
2561+
[ (configPath != null) "--config ${configPath}" ]
2562+
]);
25452563
convco = hooks.convco.package;
25462564
script = pkgs.writeShellScript "precommit-convco" ''
2547-
cat $1 | ${convco}/bin/convco check --from-stdin
2565+
cat $1 | ${convco}/bin/convco check --from-stdin ${cmdArgs}
25482566
'';
25492567
# need version >= 0.4.0 for the --from-stdin flag
25502568
toolVersionCheck = lib.versionAtLeast convco.version "0.4.0";

0 commit comments

Comments
 (0)