Add treefmt-nix for formatting all the files

This commit is contained in:
ulic-youthlic 2025-06-06 11:02:49 +08:00
parent 1a9a4243fe
commit ea42d407d7
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
6 changed files with 117 additions and 45 deletions

View file

@ -133,6 +133,12 @@
utils.follows = "flake-utils";
};
};
treefmt-nix = {
type = "github";
owner = "numtide";
repo = "treefmt-nix";
};
};
outputs = {
self,
@ -153,6 +159,7 @@
systems = flake-utils.lib.defaultSystems;
imports = [
inputs.home-manager.flakeModules.home-manager
inputs.treefmt-nix.flakeModule
nixos
home
deploy
@ -169,7 +176,6 @@
allowUnfree = true;
};
};
formatter = pkgs.alejandra;
packages = import ./pkgs (
args
// {
@ -185,6 +191,40 @@
nvfetcher
];
};
treefmt = {
programs = {
alejandra = {
enable = true;
excludes = ["pkgs/_sources/*.nix"];
};
biome = {
enable = true;
includes = ["*.json"];
excludes = ["pkgs/_sources/*.json"];
settings = {
javascript.formatter.enabled = false;
css.formatter.enabled = false;
};
};
dprint = {
enable = true;
includes = ["*.md" "*.toml" "*.yaml"];
excludes = ["secrets/*.yaml"];
settings = {
plugins = pkgs.dprint-plugins.getPluginList (plugins:
with plugins; [
dprint-plugin-toml
dprint-plugin-markdown
g-plane-pretty_yaml
]);
};
};
just = {
enable = true;
includes = [".justfile"];
};
};
};
};
flake = {
overlays = {