Skip to content

Commit bad3586

Browse files
committed
hooks: allow strings for path-based options
This is important in flake-based environments, in which anything referenced by path in Nix needs to be tracked by Git. This is often infeasable, for example, for files in node_modules.
1 parent 94ee657 commit bad3586

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

modules/hooks.nix

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,10 @@ in
172172
options.settings = {
173173
binPath =
174174
mkOption {
175-
type = types.nullOr types.path;
176-
description = "`biome` binary path. E.g. if you want to use the `biome` in `node_modules`, use `./node_modules/.bin/biome`.";
175+
type = types.nullOr (types.oneOf [ types.str types.path ]);
176+
description = ''
177+
`biome` binary path. For example, if you want to use the `biome` binary from `node_modules`, use `"./node_modules/.bin/biome"`.
178+
'';
177179
default = null;
178180
};
179181

@@ -464,9 +466,10 @@ in
464466
options.settings = {
465467
binPath =
466468
mkOption {
467-
type = types.nullOr types.path;
468-
description =
469-
"`eslint` binary path. E.g. if you want to use the `eslint` in `node_modules`, use `./node_modules/.bin/eslint`.";
469+
type = types.nullOr (types.oneOf [ types.str types.path ]);
470+
description = ''
471+
`eslint` binary path. For example, if you want to use the `eslint` binary from `node_modules`, use `"./node_modules/.bin/eslint"`.
472+
'';
470473
default = null;
471474
defaultText = lib.literalExpression "\${tools.eslint}/bin/eslint";
472475
};
@@ -619,7 +622,7 @@ in
619622
options.settings = {
620623
hintFile =
621624
mkOption {
622-
type = types.nullOr types.path;
625+
type = types.nullOr (types.oneOf [ types.str types.path ]);
623626
description = "Path to hlint.yaml. By default, hlint searches for .hlint.yaml in the project root.";
624627
default = null;
625628
};
@@ -822,7 +825,7 @@ in
822825
options.settings = {
823826
binPath =
824827
mkOption {
825-
type = types.nullOr types.path;
828+
type = types.nullOr (types.oneOf [ types.str types.path ]);
826829
description = "mkdocs-linkcheck binary path. Should be used to specify the mkdocs-linkcheck binary from your Nix-managed Python environment.";
827830
default = null;
828831
defaultText = lib.literalExpression ''
@@ -1046,9 +1049,10 @@ in
10461049
options.settings = {
10471050
binPath =
10481051
mkOption {
1049-
description =
1050-
"`prettier` binary path. E.g. if you want to use the `prettier` in `node_modules`, use `./node_modules/.bin/prettier`.";
1051-
type = types.nullOr types.path;
1052+
description = ''
1053+
`prettier` binary path. For example, if you want to use the `prettier` binary from `node_modules`, use `"./node_modules/.bin/prettier"`.
1054+
'';
1055+
type = types.nullOr (types.oneOf [ types.str types.path ]);
10521056
default = null;
10531057
defaultText = lib.literalExpression ''
10541058
"''${tools.prettier}/bin/prettier"
@@ -1137,7 +1141,7 @@ in
11371141
description = "Path to a file containing patterns that describe files to ignore.
11381142
By default, prettier looks for `./.gitignore` and `./.prettierignore`.
11391143
Multiple values are accepted.";
1140-
type = types.listOf types.path;
1144+
type = types.listOf (types.oneOf [ types.str types.path ]);
11411145
default = [ ];
11421146
};
11431147
ignore-unknown =
@@ -1414,8 +1418,10 @@ in
14141418
options.settings = {
14151419
binPath =
14161420
mkOption {
1417-
type = types.nullOr types.path;
1418-
description = "`biome` binary path. E.g. if you want to use the `biome` in `node_modules`, use `./node_modules/.bin/biome`.";
1421+
type = types.nullOr (types.oneOf [ types.str types.path ]);
1422+
description = ''
1423+
`biome` binary path. For example, if you want to use the `biome` binary from `node_modules`, use `"./node_modules/.bin/biome"`.
1424+
'';
14191425
default = null;
14201426
defaultText = "\${tools.biome}/bin/biome";
14211427
};

0 commit comments

Comments
 (0)