nichts/parts/fmt.nix
2024-07-22 00:05:07 +02:00

34 lines
838 B
Nix

{
perSystem = {
config,
pkgs,
...
}: {
# https://github.com/numtide/treefmt-nix?tab=readme-ov-file#flake-parts
formatter = config.treefmt.build.wrapper;
treefmt = {
projectRootFile = "flake.nix";
enableDefaultExcludes = true;
programs = {
alejandra.enable = true;
shellcheck.enable = true; # cannot be configured, errors on basic bash convention
prettier = {
enable = true;
package = pkgs.prettierd;
excludes = ["*.age"];
settings = {
editorconfig = true;
};
};
shfmt = {
enable = true;
# https://flake.parts/options/treefmt-nix.html#opt-perSystem.treefmt.programs.shfmt.indent_size
indent_size = 2; # set to 0 to use tabs
};
};
};
};
}