/ treefmt.nix
treefmt.nix
 1  { lib, pkgs, ... }:
 2  
 3  {
 4    tree-root-file = "treefmt.nix";
 5    on-unmatched = "fatal";
 6  
 7    excludes = [
 8      "*.lock"
 9      "*.md"
10      ".envrc"
11      ".gitignore"
12      "LICENSE"
13    ];
14  
15    formatter.nixfmt = {
16      command = lib.getExe pkgs.nixfmt;
17      includes = [ "*.nix" ];
18      options = [ "--strict" ];
19    };
20  
21    formatter.prettier = {
22      command = lib.getExe pkgs.nodePackages.prettier;
23      includes = [
24        "*.json"
25        "*.yml"
26      ];
27      options = [ "--write" ];
28    };
29  
30    formatter.rustfmt = {
31      command = lib.getExe pkgs.rustfmt;
32      includes = [ "*.rs" ];
33      options = [
34        "--config=skip_children=true"
35        "--edition=2024"
36      ];
37    };
38  
39    formatter.taplo = {
40      command = lib.getExe pkgs.taplo;
41      includes = [ "*.toml" ];
42      options = [
43        "format"
44        "--option=column_width=120"
45        "--option=align_comments=false"
46      ];
47    };
48  }