forked from numtide/treefmt-nix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclang-tidy.nix
More file actions
66 lines (63 loc) · 1.44 KB
/
Copy pathclang-tidy.nix
File metadata and controls
66 lines (63 loc) · 1.44 KB
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
{
config,
mkFormatterModule,
lib,
...
}:
let
cfg = config.programs.clang-tidy;
in
{
meta.maintainers = [ ];
imports = [
(mkFormatterModule {
name = "clang-tidy";
package = "clang-tools";
mainProgram = "clang-tidy";
includes = [
"*.c"
"*.cc"
"*.cpp"
"*.h"
"*.hh"
"*.hpp"
"*.glsl"
"*.vert"
".tesc"
".tese"
".geom"
".frag"
".comp"
];
})
];
options.programs.clang-tidy = {
configFile = lib.mkOption {
type = lib.types.nullOr lib.types.path;
description = "Specify the path of .clang-tidy or custom config file";
default = null;
example = "/some/path/myTidyConfigFile";
};
compileCommandsPath = lib.mkOption {
type = with lib.types; nullOr (either path str);
description = "used to read a compile command database";
default = null;
example = "/my/cmake/build/directory";
};
quiet = lib.mkOption {
type = lib.types.bool;
description = "Run clang-tidy in quiet mode";
default = true;
};
};
config = lib.mkIf cfg.enable {
settings.formatter.clang-tidy = {
options = [
"--fix"
]
++ lib.optional (cfg.configFile != null) "--config-file=${cfg.configFile}"
++ lib.optional (cfg.compileCommandsPath != null) "-p=${cfg.compileCommandsPath}"
++ lib.optional cfg.quiet "--quiet";
};
};
}