Skip to content

Commit 4c09990

Browse files
authored
Merge pull request #550 from cachix/fix-prettier-bin-path
2 parents 94ee657 + 46171f0 commit 4c09990

File tree

1 file changed

+52
-19
lines changed

1 file changed

+52
-19
lines changed

modules/hooks.nix

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,19 @@ 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.
178+
For example, if you want to use the `biome` binary from `node_modules`, use `"./node_modules/.bin/biome"`.
179+
Use a string instead of a path to avoid having to Git track the file in projects that use Nix flakes.
180+
'';
177181
default = null;
182+
defaultText = lib.literalExpression ''
183+
"''${tools.biome}/bin/biome"
184+
'';
185+
example = lib.literalExpression ''
186+
"./node_modules/.bin/biome"
187+
'';
178188
};
179189

180190
write =
@@ -464,11 +474,19 @@ in
464474
options.settings = {
465475
binPath =
466476
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`.";
477+
type = types.nullOr (types.oneOf [ types.str types.path ]);
478+
description = ''
479+
`eslint` binary path.
480+
For example, if you want to use the `eslint` binary from `node_modules`, use `"./node_modules/.bin/eslint"`.
481+
Use a string instead of a path to avoid having to Git track the file in projects that use Nix flakes.
482+
'';
470483
default = null;
471-
defaultText = lib.literalExpression "\${tools.eslint}/bin/eslint";
484+
defaultText = lib.literalExpression ''
485+
"''${tools.eslint}/bin/eslint"
486+
'';
487+
example = lib.literalExpression ''
488+
"./node_modules/.bin/eslint"
489+
'';
472490
};
473491

474492
extensions =
@@ -489,7 +507,7 @@ in
489507
binPath =
490508
mkOption {
491509
type = types.nullOr types.str;
492-
description = "flake8 binary path. Should be used to specify flake8 binary from your Nix-managed Python environment.";
510+
description = "flake8 binary path. Should be used to specify flake8 binary from your Python environment.";
493511
default = null;
494512
defaultText = lib.literalExpression ''
495513
"''${tools.flake8}/bin/flake8"
@@ -619,7 +637,7 @@ in
619637
options.settings = {
620638
hintFile =
621639
mkOption {
622-
type = types.nullOr types.path;
640+
type = types.nullOr (types.oneOf [ types.str types.path ]);
623641
description = "Path to hlint.yaml. By default, hlint searches for .hlint.yaml in the project root.";
624642
default = null;
625643
};
@@ -822,8 +840,8 @@ in
822840
options.settings = {
823841
binPath =
824842
mkOption {
825-
type = types.nullOr types.path;
826-
description = "mkdocs-linkcheck binary path. Should be used to specify the mkdocs-linkcheck binary from your Nix-managed Python environment.";
843+
type = types.nullOr (types.oneOf [ types.str types.path ]);
844+
description = "mkdocs-linkcheck binary path. Should be used to specify the mkdocs-linkcheck binary from your Python environment.";
827845
default = null;
828846
defaultText = lib.literalExpression ''
829847
"''${tools.mkdocs-linkcheck}/bin/mkdocs-linkcheck"
@@ -1046,13 +1064,19 @@ in
10461064
options.settings = {
10471065
binPath =
10481066
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;
1067+
description = ''
1068+
`prettier` binary path.
1069+
For example, if you want to use the `prettier` binary from `node_modules`, use `"./node_modules/.bin/prettier"`.
1070+
Use a string instead of a path to avoid having to Git track the file in projects that use Nix flakes.
1071+
'';
1072+
type = types.nullOr (types.oneOf [ types.str types.path ]);
10521073
default = null;
10531074
defaultText = lib.literalExpression ''
10541075
"''${tools.prettier}/bin/prettier"
10551076
'';
1077+
example = lib.literalExpression ''
1078+
"./node_modules/.bin/prettier"
1079+
'';
10561080
};
10571081
allow-parens =
10581082
mkOption {
@@ -1137,7 +1161,7 @@ in
11371161
description = "Path to a file containing patterns that describe files to ignore.
11381162
By default, prettier looks for `./.gitignore` and `./.prettierignore`.
11391163
Multiple values are accepted.";
1140-
type = types.listOf types.path;
1164+
type = types.listOf (types.oneOf [ types.str types.path ]);
11411165
default = [ ];
11421166
};
11431167
ignore-unknown =
@@ -1307,7 +1331,7 @@ in
13071331
binPath =
13081332
mkOption {
13091333
type = types.nullOr types.str;
1310-
description = "Pylint binary path. Should be used to specify Pylint binary from your Nix-managed Python environment.";
1334+
description = "Pylint binary path. Should be used to specify Pylint binary from your Python environment.";
13111335
default = null;
13121336
defaultText = lib.literalExpression ''
13131337
"''${tools.pylint}/bin/pylint"
@@ -1353,7 +1377,7 @@ in
13531377
binPath =
13541378
mkOption {
13551379
type = types.nullOr types.str;
1356-
description = "pyupgrade binary path. Should be used to specify the pyupgrade binary from your Nix-managed Python environment.";
1380+
description = "pyupgrade binary path. Should be used to specify the pyupgrade binary from your Python environment.";
13571381
default = null;
13581382
defaultText = lib.literalExpression ''
13591383
"''${tools.pyupgrade}/bin/pyupgrade"
@@ -1414,10 +1438,19 @@ in
14141438
options.settings = {
14151439
binPath =
14161440
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`.";
1441+
type = types.nullOr (types.oneOf [ types.str types.path ]);
1442+
description = ''
1443+
`rome` binary path.
1444+
For example, if you want to use the `rome` binary from `node_modules`, use `"./node_modules/.bin/rome"`.
1445+
Use a string instead of a path to avoid having to Git track the file in projects that use Nix flakes.
1446+
'';
14191447
default = null;
1420-
defaultText = "\${tools.biome}/bin/biome";
1448+
defaultText = lib.literalExpression ''
1449+
"''${tools.rome}/bin/rome
1450+
'';
1451+
example = lib.literalExpression ''
1452+
"./node_modules/.bin/rome"
1453+
'';
14211454
};
14221455

14231456
write =

0 commit comments

Comments
 (0)