try fufexans git hooks setup
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
.direnv
|
||||
.pre-commit-config.yaml
|
||||
result*
|
||||
|
||||
14
flake.nix
14
flake.nix
@@ -9,6 +9,7 @@
|
||||
./users
|
||||
./hosts
|
||||
./modules
|
||||
./fmt-hooks.nix
|
||||
];
|
||||
|
||||
perSystem = {pkgs, ...}: {
|
||||
@@ -105,6 +106,19 @@
|
||||
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
|
||||
tuirun = {
|
||||
url = "git+https://git.sr.ht/~canasta/tuirun";
|
||||
|
||||
26
fmt-hooks.nix
Normal file
26
fmt-hooks.nix
Normal 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"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -79,7 +79,7 @@
|
||||
auto-format = true;
|
||||
language-servers = ["nil"];
|
||||
formatter = {
|
||||
command = "${pkgs.alejandra}/bin/alejandra";
|
||||
command = "${pkgs.nixfmt}/bin/nixfmt";
|
||||
args = ["-q"];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user