treefmt-nix icon indicating copy to clipboard operation
treefmt-nix copied to clipboard

New formatter; cljstyle

Open conao3 opened this issue 3 months ago • 1 comments

Is your feature request related to a problem? Please describe. I'm using treefmt-nix for Clojure projects, but cljstyle (a Clojure code formatter) is not supported as a built-in program. Currently, I need to manually configure it as a custom formatter.

Describe the solution you'd like Add cljstyle as a built-in program in treefmt-nix. It should work similarly to other formatters (black, rustfmt, etc.) with a simple configuration like:

{
  programs.cljstyle.enable = true;
}

Describe alternatives you've considered Currently using settings.formatter to configure it as a custom formatter, but this requires manual package management and command-line option configuration:

{
  settings.formatter.cljstyle = {
    command = "${pkgs.cljstyle}/bin/cljstyle";
    options = ["fix"];
    includes = ["*.clj" "*.cljs" "*.cljc" "*.edn"];
  };
}

Additional context cljstyle is a widely used formatter in the Clojure community. It would be helpful to have support for its configuration file (.cljstyle) and common options (check, fix, pipe).

References: cljstyle: https://github.com/greglook/cljstyle nixpkgs.cljstyle: https://search.nixos.org/packages?query=cljstyle

conao3 avatar Sep 24 '25 14:09 conao3

Yes sounds good! Happy to get a PR

zimbatm avatar Sep 24 '25 15:09 zimbatm