Closed DrRuhe closed 9 months ago
It's possible. Here is how I added formolu:
treefmt = {
projectRootFile = ".git/config";
programs.nixpkgs-fmt.enable = true;
programs.cabal-fmt.enable = true;
settings.formatter = {
"fourmolu" = {
command = pkgs.haskellPackages.fourmolu;
options = [
"--ghc-opt"
"-XImportQualifiedPost"
"--ghc-opt"
"-XTypeApplications"
"--mode"
"inplace"
"--check-idempotence"
];
includes = [ "*.hs" ];
};
};
};
You can figure it out by studying other formatter implementations. https://github.com/numtide/treefmt-nix/blob/19dee4bf6001849006a63f3435247316b0488e99/programs/ormolu.nix
Its obviously nice UX, that treefmt-nix comes with a bunch of formatters set-up. But a thing that seems to be missing is being able to specify a custom formatter, one that has yet to find its way into treefmt-nix.
For example, I tried specifying treefmt to utilize
typstfmt
in the flake-parts module like this:This fails with a:
Describe the solution you'd like
Ideally it would just work :)