fix pre-commit hook

This commit is contained in:
2026-04-26 18:16:37 +02:00
parent b319cd93e9
commit 49a63fd6aa
2 changed files with 11 additions and 6 deletions

6
.githooks/pre-commit Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
nix fmt .
git diff --exit-code || {
echo "Formatter changed files — review with 'git diff', then re-stage and commit."
exit 1
}

View File

@@ -10,13 +10,12 @@
programs = { programs = {
git = { git = {
enable = true; enable = true;
hooks.pre-commit = pkgs.writeShellScript "pre-commit" '' includes = [
nix fmt . {
git diff --exit-code || { condition = "gitdir:~/.setup/";
echo "Formatter changed files review with 'git diff', then re-stage and commit." contents.core.hooksPath = "~/.setup/.githooks";
exit 1
} }
''; ];
settings = { settings = {
user.name = "Kabbone"; user.name = "Kabbone";
user.email = "tobias@opel-online.de"; user.email = "tobias@opel-online.de";