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

@ -1,2 +1 @@
{ {}
}

37
flake.lock generated
View file

@ -605,6 +605,22 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": {
"locked": {
"lastModified": 1747958103,
"narHash": "sha256-qmmFCrfBwSHoWw7cVK4Aj+fns+c54EBP8cGqp/yK410=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "fe51d34885f7b5e3e7b59572796e1bcb427eccb1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nur": { "nur": {
"inputs": { "inputs": {
"flake-parts": [ "flake-parts": [
@ -665,7 +681,8 @@
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
"nur-rycee": "nur-rycee", "nur-rycee": "nur-rycee",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"stylix": "stylix" "stylix": "stylix",
"treefmt-nix": "treefmt-nix_2"
} }
}, },
"rust-overlay": { "rust-overlay": {
@ -904,6 +921,24 @@
"type": "github" "type": "github"
} }
}, },
"treefmt-nix_2": {
"inputs": {
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1748243702,
"narHash": "sha256-9YzfeN8CB6SzNPyPm2XjRRqSixDopTapaRsnTpXUEY8=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "1f3f7b784643d488ba4bf315638b2b0a4c5fb007",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"xwayland-satellite-stable": { "xwayland-satellite-stable": {
"flake": false, "flake": false,
"locked": { "locked": {

View file

@ -133,6 +133,12 @@
utils.follows = "flake-utils"; utils.follows = "flake-utils";
}; };
}; };
treefmt-nix = {
type = "github";
owner = "numtide";
repo = "treefmt-nix";
};
}; };
outputs = { outputs = {
self, self,
@ -153,6 +159,7 @@
systems = flake-utils.lib.defaultSystems; systems = flake-utils.lib.defaultSystems;
imports = [ imports = [
inputs.home-manager.flakeModules.home-manager inputs.home-manager.flakeModules.home-manager
inputs.treefmt-nix.flakeModule
nixos nixos
home home
deploy deploy
@ -169,7 +176,6 @@
allowUnfree = true; allowUnfree = true;
}; };
}; };
formatter = pkgs.alejandra;
packages = import ./pkgs ( packages = import ./pkgs (
args args
// { // {
@ -185,6 +191,40 @@
nvfetcher 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 = { flake = {
overlays = { overlays = {

View file

@ -51,7 +51,6 @@ repo_root_style = "bold green"
use_os_path_sep = false use_os_path_sep = false
read_only = " 󰌾" read_only = " 󰌾"
[aws] [aws]
symbol = " " symbol = " "
@ -210,4 +209,3 @@ symbol = " "
[zig] [zig]
symbol = " " symbol = " "

View file

@ -92,7 +92,7 @@ allow = [
"MIT", "MIT",
# "Apache-2.0", # "Apache-2.0",
# "Apache-2.0 WITH LLVM-exception", # "Apache-2.0 WITH LLVM-exception",
"GPL-3.0" "GPL-3.0",
] ]
# The confidence threshold for detecting a license from license text. # The confidence threshold for detecting a license from license text.
# The higher the value, the more closely the license text must be to the # The higher the value, the more closely the license text must be to the