{
  sources ? import ../npins,
  pkgs ? import sources.nixpkgs { },
  treefmt ? import sources.treefmt-nix,
}:
let
  globalExcludes = [
    "npins/default.nix"
    "attic"
    "vcluster"
    ".*vendor"
    ".*chart/.*"
    ".*schema.json"
  ];
in
treefmt.evalModule pkgs {
  projectRootFile = ".git/config";

  settings = {
    excludes = globalExcludes;
  };

  programs = {

    # --- Nix formatting ---
    nixfmt = {
      enable = true;
      package = pkgs.nixfmt-rfc-style;
    };
    statix.enable = true;
    deadnix.enable = true;

    # --- Shell ---
    shellcheck = {
      enable = true;
      excludes = [
        "vcluster/"
        "attic/"
      ];
    };

    shfmt.enable = true;

    # --- YAML ---
    yamllint = {
      enable = true;
      excludes = [
        "attic/"
        "charts/templates/"
        "charts/"
        "values/"
        "vcluster/"
      ];
      settings = {
        extends = "default";
        rules = {
          document-start = "disable";
          line-length = {
            max = 300;
          };
        };
      };
    };

    # --- JSON ---
    jsonfmt.enable = true;

    # Optional: keep JSON sorted
    # prettier.enable = true;
  };
}
