-
Notifications
You must be signed in to change notification settings - Fork 155
/
hooks.nix
3868 lines (3788 loc) · 139 KB
/
hooks.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{ config, lib, pkgs, hookModule, ... }:
let
inherit (config) hooks tools settings;
cfg = config;
inherit (lib) flatten mapAttrs mapAttrsToList mkDefault mkOption mkRemovedOptionModule mkRenamedOptionModule types;
cargoManifestPathArg =
lib.optionalString
(settings.rust.cargoManifestPath != null)
"--manifest-path ${lib.escapeShellArg settings.rust.cargoManifestPath}";
mkCmdArgs = predActionList:
lib.concatStringsSep
" "
(builtins.foldl'
(acc: entry:
acc ++ lib.optional (builtins.elemAt entry 0) (builtins.elemAt entry 1))
[ ]
predActionList);
migrateBinPathToPackage = hook: binPath:
if hook.settings.binPath == null
then "${hook.package}${binPath}"
else hook.settings.binPath;
in
{
imports =
# Rename `settings.<name>.package` to `hooks.<name>.package`
map (name: mkRenamedOptionModule [ "settings" name "package" ] [ "hooks" name "package" ]) [ "alejandra" "eclint" "flynt" "mdl" "treefmt" ]
# These options were renamed in 20fbe2c9731810b1020572a2cb6cbf64e3dd3873 to avoid shadowing
++ map (name: mkRenamedOptionModule [ "settings" name "config" ] [ "hooks" name "settings" "configuration" ]) [ "lua-ls" "markdownlint" "typos" "vale" ]
++ [
(mkRemovedOptionModule [ "settings" "yamllint" "relaxed" ] ''
This option has been removed. Use `hooks.yamllint.settings.preset = "relaxed"`.
'')
]
# Manually rename options that had a package or a config option
++ flatten (mapAttrsToList (name: map (o: mkRenamedOptionModule [ "settings" name o ] [ "hooks" name "settings" o ])) {
"alejandra" = [ "check" "exclude" "threads" "verbosity" ];
"eclint" = [ "fix" "summary" "color" "exclude" "verbosity" ];
"flynt" = [ "aggressive" "binPath" "dry-run" "exclude" "fail-on-change" "line-length" "no-multiline" "quiet" "string" "transform-concats" "verbose" ];
"mdl" = [ "configPath" "git-recurse" "ignore-front-matter" "json" "rules" "rulesets" "show-aliases" "warnings" "skip-default-ruleset" "style" "tags" "verbose" ];
"lua-ls" = [ "checklevel" ];
"typos" = [ "binary" "color" "configPath" "diff" "exclude" "format" "hidden" "ignored-words" "locale" "no-check-filenames" "no-check-files" "no-unicode" "quiet" "verbose" "write" ];
"vale" = [ "configPath" "flags" ];
"yamllint" = [ "configPath" ];
})
# Rename `rome` hook to `biome`, since `biome` was being used in both hooks
++ [ (mkRenamedOptionModule [ "settings" "rome" ] [ "hooks" "biome" "settings" ]) ]
# Rename the remaining `settings.<name>` to `hooks.<name>.settings`
++ map (name: mkRenamedOptionModule [ "settings" name ] [ "hooks" name "settings" ])
[ "ansible-lint" "autoflake" "biome" "clippy" "cmake-format" "credo" "deadnix" "denofmt" "denolint" "dune-fmt" "eslint" "flake8" "headache" "hlint" "hpack" "isort" "latexindent" "lychee" "mkdocs-linkcheck" "mypy" "nixfmt" "ormolu" "php-cs-fixer" "phpcbf" "phpcs" "phpstan" "prettier" "psalm" "pylint" "pyright" "pyupgrade" "revive" "statix" ];
options.hookModule = lib.mkOption {
type = types.deferredModule;
internal = true;
description = ''
Base module that must be loaded into each hook.
'';
};
config.hookModule = {
imports = [ ./hook.nix ];
config._module.args.default_stages = cfg.default_stages;
};
config._module.args.hookModule = config.hookModule;
# PLEASE keep this sorted alphabetically.
options.settings = {
rust.cargoManifestPath = mkOption {
type = types.nullOr types.str;
description = "Path to Cargo.toml";
default = null;
};
};
# PLEASE keep this sorted alphabetically.
options.hooks =
{
alejandra = mkOption {
description = "alejandra hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
check =
mkOption {
type = types.bool;
description = "Check if the input is already formatted and disable writing in-place the modified content";
default = false;
example = true;
};
exclude =
mkOption {
type = types.listOf types.str;
description = "Files or directories to exclude from formatting.";
default = [ ];
example = [ "flake.nix" "./templates" ];
};
threads =
mkOption {
type = types.nullOr types.int;
description = "Number of formatting threads to spawn.";
default = null;
example = 8;
};
verbosity =
mkOption {
type = types.enum [ "normal" "quiet" "silent" ];
description = "Whether informational messages or all messages should be hidden or not.";
default = "normal";
example = "quiet";
};
};
};
};
ansible-lint = mkOption {
description = "ansible-lint hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
configPath = mkOption {
type = types.str;
description = "Path to the YAML configuration file.";
# an empty string translates to use default configuration of the
# underlying ansible-lint binary
default = "";
};
subdir = mkOption {
type = types.str;
description = "Path to the Ansible subdirectory.";
default = "";
};
};
};
};
autoflake = mkOption {
description = "autoflake hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
binPath =
mkOption {
type = types.nullOr types.str;
description = "Path to autoflake binary.";
default = null;
defaultText = lib.literalExpression ''
"''${tools.autoflake}/bin/autoflake"
'';
};
flags =
mkOption {
type = types.str;
description = "Flags passed to autoflake.";
default = "--in-place --expand-star-imports --remove-duplicate-keys --remove-unused-variables";
};
};
};
};
biome = mkOption {
description = "biome hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
binPath =
mkOption {
type = types.nullOr types.path;
description = "`biome` binary path. E.g. if you want to use the `biome` in `node_modules`, use `./node_modules/.bin/biome`.";
default = null;
};
write =
mkOption {
type = types.bool;
description = "Whether to edit files inplace.";
default = true;
};
configPath = mkOption {
type = types.str;
description = "Path to the configuration JSON file";
# an empty string translates to use default configuration of the
# underlying biome binary (i.e biome.json if exists)
default = "";
};
};
};
};
black = mkOption {
description = "black hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
flags = mkOption {
type = types.str;
description = "Flags passed to black. See all available [here](https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#command-line-options).";
default = "";
example = "--skip-magic-trailing-comma";
};
};
};
};
clippy = mkOption {
description = "clippy hook";
type = types.submodule
({ config, ... }: {
imports = [ hookModule ];
options.packageOverrides = {
cargo = mkOption {
type = types.package;
description = "The cargo package to use";
};
clippy = mkOption {
type = types.package;
description = "The clippy package to use";
};
};
options.settings = {
denyWarnings = mkOption {
type = types.bool;
description = "Fail when warnings are present";
default = false;
};
offline = mkOption {
type = types.bool;
description = "Run clippy offline";
default = true;
};
allFeatures = mkOption {
type = types.bool;
description = "Run clippy with --all-features";
default = false;
};
extraArgs = mkOption {
type = types.str;
description = "Additional arguments to pass to clippy";
default = "";
};
};
config.extraPackages = [
config.packageOverrides.cargo
config.packageOverrides.clippy
];
});
};
cmake-format = mkOption {
description = "cmake-format hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
configPath = mkOption {
type = types.str;
description = "Path to the configuration file (.json,.python,.yaml)";
default = "";
example = ".cmake-format.json";
};
};
};
};
credo = mkOption {
description = "credo hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
strict =
mkOption {
type = types.bool;
description = "Whether to auto-promote the changes.";
default = true;
};
};
};
};
deadnix = mkOption {
description = "deadnix hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
edit =
mkOption {
type = types.bool;
description = "Remove unused code and write to source file.";
default = false;
};
exclude =
mkOption {
type = types.listOf types.str;
description = "Files to exclude from analysis.";
default = [ ];
};
hidden =
mkOption {
type = types.bool;
description = "Recurse into hidden subdirectories and process hidden .*.nix files.";
default = false;
};
noLambdaArg =
mkOption {
type = types.bool;
description = "Don't check lambda parameter arguments.";
default = false;
};
noLambdaPatternNames =
mkOption {
type = types.bool;
description = "Don't check lambda pattern names (don't break nixpkgs `callPackage`).";
default = false;
};
noUnderscore =
mkOption {
type = types.bool;
description = "Don't check any bindings that start with a `_`.";
default = false;
};
quiet =
mkOption {
type = types.bool;
description = "Don't print a dead code report.";
default = false;
};
};
};
};
denofmt = mkOption {
description = "denofmt hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
write =
mkOption {
type = types.bool;
description = "Whether to edit files inplace.";
default = true;
};
configPath =
mkOption {
type = types.str;
description = "Path to the configuration JSON file";
# an empty string translates to use default configuration of the
# underlying deno binary (i.e deno.json or deno.jsonc)
default = "";
};
};
};
};
denolint = mkOption {
description = "denolint hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
format =
mkOption {
type = types.enum [ "default" "compact" "json" ];
description = "Output format.";
default = "default";
};
configPath =
mkOption {
type = types.str;
description = "Path to the configuration JSON file";
# an empty string translates to use default configuration of the
# underlying deno binary (i.e deno.json or deno.jsonc)
default = "";
};
};
};
};
dune-fmt = mkOption {
description = "dune-fmt hook";
type = types.submodule
({ config, ... }: {
imports = [ hookModule ];
options.settings = {
auto-promote =
mkOption {
type = types.bool;
description = "Whether to auto-promote the changes.";
default = true;
};
extraRuntimeInputs =
mkOption {
type = types.listOf types.package;
description = "Extra runtimeInputs to add to the environment, eg. `ocamlformat`.";
default = [ ];
};
};
config.extraPackages = config.settings.extraRuntimeInputs;
});
};
eclint = mkOption {
description = "eclint hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
fix =
mkOption {
type = types.bool;
description = "Modify files in place rather than showing the errors.";
default = false;
};
summary =
mkOption {
type = types.bool;
description = "Only show number of errors per file.";
default = false;
};
color =
mkOption {
type = types.enum [ "auto" "always" "never" ];
description = "When to generate colored output.";
default = "auto";
};
exclude =
mkOption {
type = types.listOf types.str;
description = "Filter to exclude files.";
default = [ ];
};
verbosity =
mkOption {
type = types.enum [ 0 1 2 3 4 ];
description = "Log level verbosity";
default = 0;
};
};
};
};
eslint = mkOption {
description = "eslint hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
binPath =
mkOption {
type = types.nullOr types.path;
description =
"`eslint` binary path. E.g. if you want to use the `eslint` in `node_modules`, use `./node_modules/.bin/eslint`.";
default = null;
defaultText = lib.literalExpression "\${tools.eslint}/bin/eslint";
};
extensions =
mkOption {
type = types.str;
description =
"The pattern of files to run on, see [https://pre-commit.com/#hooks-files](https://pre-commit.com/#hooks-files).";
default = "\\.js$";
};
};
};
};
flake8 = mkOption {
description = "flake8 hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
binPath =
mkOption {
type = types.nullOr types.str;
description = "flake8 binary path. Should be used to specify flake8 binary from your Nix-managed Python environment.";
default = null;
defaultText = lib.literalExpression ''
"''${tools.flake8}/bin/flake8"
'';
};
extendIgnore =
mkOption {
type = types.listOf types.str;
description = "List of additional ignore codes";
default = [ ];
example = [ "E501" ];
};
format =
mkOption {
type = types.str;
description = "Output format.";
default = "default";
};
};
};
};
flynt = mkOption {
description = "flynt hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
aggressive =
mkOption {
type = types.bool;
description = "Include conversions with potentially changed behavior.";
default = false;
};
binPath =
mkOption {
type = types.nullOr types.str;
description = "flynt binary path. Can be used to specify the flynt binary from an existing Python environment.";
default = null;
};
dry-run =
mkOption {
type = types.bool;
description = "Do not change files in-place and print diff instead.";
default = false;
};
exclude =
mkOption {
type = types.listOf types.str;
description = "Ignore files with given strings in their absolute path.";
default = [ ];
};
fail-on-change =
mkOption {
type = types.bool;
description = "Fail when diff is not empty (for linting purposes).";
default = true;
};
line-length =
mkOption {
type = types.nullOr types.int;
description = "Convert expressions spanning multiple lines, only if the resulting single line will fit into this line length limit.";
default = null;
};
no-multiline =
mkOption {
type = types.bool;
description = "Convert only single line expressions.";
default = false;
};
quiet =
mkOption {
type = types.bool;
description = "Run without output.";
default = false;
};
string =
mkOption {
type = types.bool;
description = "Interpret the input as a Python code snippet and print the converted version.";
default = false;
};
transform-concats =
mkOption {
type = types.bool;
description = "Replace string concatenations with f-strings.";
default = false;
};
verbose =
mkOption {
type = types.bool;
description = "Run with verbose output.";
default = false;
};
};
};
};
golines = mkOption {
description = "golines hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
flags = mkOption {
type = types.str;
description = "Flags passed to golines. See all available [here](https://github.com/segmentio/golines?tab=readme-ov-file#options)";
default = "";
example = "-m 120";
};
};
};
};
headache = mkOption {
description = "headache hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
header-file = mkOption {
type = types.str;
description = "Path to the header file.";
default = ".header";
};
};
};
};
hlint = mkOption {
description = "hlint hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
hintFile =
mkOption {
type = types.nullOr types.path;
description = "Path to hlint.yaml. By default, hlint searches for .hlint.yaml in the project root.";
default = null;
};
};
};
};
hpack = mkOption {
description = "hpack hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
silent =
mkOption {
type = types.bool;
description = "Whether generation should be silent.";
default = false;
};
};
};
};
isort = mkOption {
description = "isort hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
profile =
mkOption {
type = types.enum [ "" "black" "django" "pycharm" "google" "open_stack" "plone" "attrs" "hug" "wemake" "appnexus" ];
description = "Built-in profiles to allow easy interoperability with common projects and code styles.";
default = "";
};
flags =
mkOption {
type = types.str;
description = "Flags passed to isort. See all available [here](https://pycqa.github.io/isort/docs/configuration/options.html).";
default = "";
};
};
};
};
latexindent = mkOption {
description = "latexindent hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
flags =
mkOption {
type = types.str;
description = "Flags passed to latexindent. See available flags [here](https://latexindentpl.readthedocs.io/en/latest/sec-how-to-use.html#from-the-command-line)";
default = "--local --silent --overwriteIfDifferent";
};
};
};
};
lacheck = mkOption {
description = "lacheck hook";
type = types.submodule {
imports = [ hookModule ];
};
};
lua-ls = mkOption {
description = "lua-ls hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
checklevel = mkOption {
type = types.enum [ "Error" "Warning" "Information" "Hint" ];
description =
"The diagnostic check level";
default = "Warning";
};
configuration = mkOption {
type = types.attrs;
description =
"See https://github.com/LuaLS/lua-language-server/wiki/Configuration-File#luarcjson";
default = { };
};
};
};
};
lychee = mkOption {
description = "lychee hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
configPath =
mkOption {
type = types.str;
description = "Path to the config file.";
default = "";
};
flags =
mkOption {
type = types.str;
description = "Flags passed to lychee. See all available [here](https://lychee.cli.rs/#/usage/cli).";
default = "";
};
};
};
};
markdownlint = mkOption {
description = "markdownlint hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
configuration =
mkOption {
type = types.attrs;
description =
"See https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.jsonc";
default = { };
};
};
};
};
mdl = mkOption {
description = "mdl hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
configPath =
mkOption {
type = types.str;
description = "The configuration file to use.";
default = "";
};
git-recurse =
mkOption {
type = types.bool;
description = "Only process files known to git when given a directory.";
default = false;
};
ignore-front-matter =
mkOption {
type = types.bool;
description = "Ignore YAML front matter.";
default = false;
};
json =
mkOption {
type = types.bool;
description = "Format output as JSON.";
default = false;
};
rules =
mkOption {
type = types.listOf types.str;
description = "Markdown rules to use for linting. Per default all rules are processed.";
default = [ ];
};
rulesets =
mkOption {
type = types.listOf types.str;
description = "Specify additional ruleset files to load.";
default = [ ];
};
show-aliases =
mkOption {
type = types.bool;
description = "Show rule alias instead of rule ID when viewing rules.";
default = false;
};
warnings =
mkOption {
type = types.bool;
description = "Show Kramdown warnings.";
default = false;
};
skip-default-ruleset =
mkOption {
type = types.bool;
description = "Do not load the default markdownlint ruleset. Use this option if you only want to load custom rulesets.";
default = false;
};
style =
mkOption {
type = types.str;
description = "Select which style mdl uses.";
default = "default";
};
tags =
mkOption {
type = types.listOf types.str;
description = "Markdown rules to use for linting containing the given tags. Per default all rules are processed.";
default = [ ];
};
verbose =
mkOption {
type = types.bool;
description = "Increase verbosity.";
default = false;
};
};
};
};
mkdocs-linkcheck = mkOption {
description = "mkdocs-linkcheck hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
binPath =
mkOption {
type = types.nullOr types.path;
description = "mkdocs-linkcheck binary path. Should be used to specify the mkdocs-linkcheck binary from your Nix-managed Python environment.";
default = null;
defaultText = lib.literalExpression ''
"''${tools.mkdocs-linkcheck}/bin/mkdocs-linkcheck"
'';
};
path =
mkOption {
type = types.str;
description = "Path to check";
default = "";
};
local-only =
mkOption {
type = types.bool;
description = "Whether to only check local links.";
default = false;
};
recurse =
mkOption {
type = types.bool;
description = "Whether to recurse directories under path.";
default = false;
};
extension =
mkOption {
type = types.str;
description = "File extension to scan for.";
default = "";
};
method =
mkOption {
type = types.enum [ "get" "head" ];
description = "HTTP method to use when checking external links.";
default = "get";
};
};
};
};
mypy = mkOption {
description = "mypy hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
binPath =
mkOption {
type = types.nullOr types.str;
description = "Mypy binary path. Should be used to specify the mypy executable in an environment containing your typing stubs.";
default = null;
defaultText = lib.literalExpression ''
"''${tools.mypy}/bin/mypy"
'';
};
};
};
};
nixfmt = mkOption {
description = "Deprecated nixfmt hook. Use nixfmt-classic or nixfmt-rfc-style instead.";
visible = false;
type = types.submodule {
imports = [ hookModule ];
options.settings = {
width =
mkOption {
type = types.nullOr types.int;
description = "Line width.";
default = null;
};
};
};
};
nixfmt-classic = mkOption {
description = "nixfmt (classic) hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
width =
mkOption {
type = types.nullOr types.int;
description = "Line width.";
default = null;
};
};
};
};
nixfmt-rfc-style = mkOption {
description = "nixfmt (RFC 166 style) hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
width =
mkOption {
type = types.nullOr types.int;
description = "Line width.";
default = null;
};
};
};
};
no-commit-to-branch = mkOption {
description = "no-commit-to-branch-hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
branch =
mkOption {
description = "Branches to disallow commits to.";
type = types.listOf types.str;
default = [ "main" ];
example = [ "main" "master" ];
};
pattern =
mkOption {
description = "RegEx patterns for branch names to disallow commits to.";
type = types.listOf types.str;
default = [ ];
example = [ "ma.*" ];
};
};
};
};
ormolu = mkOption {
description = "ormolu hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
defaultExtensions =
mkOption {
type = types.listOf types.str;
description = "Haskell language extensions to enable.";
default = [ ];
};
cabalDefaultExtensions =
mkOption {
type = types.bool;
description = "Use `default-extensions` from `.cabal` files.";
default = false;
};
};
};
};
php-cs-fixer = mkOption {
description = "php-cs-fixer hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
binPath =
mkOption {
type = types.nullOr types.str;
description = "PHP-CS-Fixer binary path.";
default = null;
defaultText = lib.literalExpression ''
"''${tools.php-cs-fixer}/bin/php-cs-fixer"
'';
};
};
};
};
phpcbf = mkOption {
description = "phpcbf hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
binPath =
mkOption {
type = types.nullOr types.str;
description = "PHP_CodeSniffer binary path.";
default = null;
defaultText = lib.literalExpression ''
"''${tools.phpcbf}/bin/phpcbf"
'';
};
};
};
};
phpcs = mkOption {
description = "phpcs hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
binPath =
mkOption {
type = types.nullOr types.str;
description = "PHP_CodeSniffer binary path.";
default = null;
defaultText = lib.literalExpression ''
"''${tools.phpcs}/bin/phpcs"
'';
};
};
};
};