feat: add treefmt.nix setup

Add a treefmt setup for a single-entry point format-everything system.
To use it, simply run `nix fmt`. This will in term run nixfmt, prettier
and rustfmt.

Signed-off-by: wucke13 <wucke13+github@gmail.com>
This commit is contained in:
wucke13
2025-04-13 12:52:41 +02:00
committed by Karolin Varner
parent 1025de2c64
commit a45812b2cd
3 changed files with 61 additions and 16 deletions

30
treefmt.nix Normal file
View File

@@ -0,0 +1,30 @@
{ pkgs, ... }:
{
# Used to find the project root
projectRootFile = "flake.nix";
programs.nixfmt.enable = true;
programs.prettier = {
enable = true;
includes = [
"*.css"
"*.html"
"*.js"
"*.json"
"*.json5"
"*.md"
"*.mdx"
"*.toml"
"*.yaml"
"*.yml"
];
excludes = [
"supply-chain/*"
];
settings = {
plugins = [
"${pkgs.nodePackages.prettier-plugin-toml}/lib/node_modules/prettier-plugin-toml/lib/index.js"
];
};
};
programs.rustfmt.enable = true;
}