-
Notifications
You must be signed in to change notification settings - Fork 5
/
formatter.nix
45 lines (38 loc) · 924 Bytes
/
formatter.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
{ pkgs, inputs, ... }:
let
hasNixFmt = pkgs.lib.meta.availableOn pkgs.stdenv.buildPlatform pkgs.nixfmt-rfc-style.compiler;
in
inputs.treefmt-nix.lib.evalModule pkgs {
projectRootFile = ".git/config";
programs = {
nixfmt.enable = hasNixFmt;
nixfmt.package = pkgs.nixfmt-rfc-style;
deadnix.enable = true;
prettier.enable = true;
statix.enable = true;
};
settings = {
global.excludes = [
"LICENSE"
"*.narHash"
# unsupported extensions
"*.{gif,png,svg,tape,mts,lock,mod,sum,toml,env,envrc,gitignore}"
];
formatter = {
deadnix = {
priority = 1;
};
statix = {
priority = 2;
};
nixfmt = pkgs.lib.mkIf hasNixFmt { priority = 3; };
prettier = {
options = [
"--tab-width"
"4"
];
includes = [ "*.{css,html,js,json,jsx,md,mdx,scss,ts,yaml}" ];
};
};
};
}