-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathdjlint.nix
More file actions
50 lines (47 loc) · 1.04 KB
/
djlint.nix
File metadata and controls
50 lines (47 loc) · 1.04 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
{
lib,
config,
mkFormatterModule,
...
}:
let
cfg = config.programs.djlint;
in
{
meta.maintainers = [ ];
imports = [
(mkFormatterModule {
name = "djlint";
includes = [ "*.html" ];
})
];
options.programs.djlint = {
lint = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether to lint in addition to formatting.";
};
ignoreRules = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = "Which H-rules to ignore";
};
indent = lib.mkOption {
type = lib.types.ints.unsigned;
default = 4;
description = "Default indentation depth in spaces";
};
};
config = lib.mkIf cfg.enable {
settings.formatter.djlint = {
options = [
"--reformat"
"--quiet"
"--indent"
(builtins.toString cfg.indent)
]
++ lib.optional cfg.lint "--lint"
++ lib.optional (cfg.ignoreRules != [ ]) ("--ignore=" + lib.concatStringsSep "," cfg.ignoreRules);
};
};
}