forked from numtide/treefmt-nix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmllint.nix
More file actions
43 lines (41 loc) · 763 Bytes
/
xmllint.nix
File metadata and controls
43 lines (41 loc) · 763 Bytes
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
{
config,
lib,
mkFormatterModule,
pkgs,
...
}:
let
cfg = config.programs.xmllint;
in
{
meta.maintainers = [ "andrea11" ];
imports = [
(mkFormatterModule {
name = "xmllint";
package = "libxml2";
includes = [
"*.xml"
"*.svg"
"*.xhtml"
"*.xsl"
"*.xslt"
"*.dtd"
"*.xsd"
];
})
];
config = lib.mkIf cfg.enable {
settings.formatter.xmllint = {
# xmllint doesn't format in place by default
command = pkgs.writeShellApplication {
name = "xmllint-wrapper";
text = ''
for file in "$@"; do
${lib.getExe' cfg.package "xmllint"} --format "$file" --output "$file"
done
'';
};
};
};
}