try fufexans git hooks setup

This commit is contained in:
2025-08-29 14:49:10 +02:00
parent 35b5f15370
commit 5de06d7b0f
4 changed files with 42 additions and 1 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
.direnv .direnv
.pre-commit-config.yaml
result* result*

View File

@@ -9,6 +9,7 @@
./users ./users
./hosts ./hosts
./modules ./modules
./fmt-hooks.nix
]; ];
perSystem = {pkgs, ...}: { perSystem = {pkgs, ...}: {
@@ -105,6 +106,19 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-compat.follows = "flake-compat";
};
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Custom # Custom
tuirun = { tuirun = {
url = "git+https://git.sr.ht/~canasta/tuirun"; url = "git+https://git.sr.ht/~canasta/tuirun";

26
fmt-hooks.nix Normal file
View File

@@ -0,0 +1,26 @@
{inputs, ...}: {
imports = [
inputs.git-hooks.flakeModule
inputs.treefmt-nix.flakeModule
];
perSystem = {
pre-commit.settings = {
excludes = ["flake.lock"];
hooks.treefmt.enable = true;
};
treefmt.programs = {
nixfmt.enable = true;
prettier = {
enable = true;
excludes = [
".js"
".md"
".ts"
];
};
};
};
}

View File

@@ -79,7 +79,7 @@
auto-format = true; auto-format = true;
language-servers = ["nil"]; language-servers = ["nil"];
formatter = { formatter = {
command = "${pkgs.alejandra}/bin/alejandra"; command = "${pkgs.nixfmt}/bin/nixfmt";
args = ["-q"]; args = ["-q"];
}; };
} }