From 49a63fd6aaa05c2decaa36d3772076bf4639bc92 Mon Sep 17 00:00:00 2001 From: Kabbone Date: Sun, 26 Apr 2026 18:16:37 +0200 Subject: [PATCH] fix pre-commit hook --- .githooks/pre-commit | 6 ++++++ modules/shell/git.nix | 11 +++++------ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100755 .githooks/pre-commit diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..317680c --- /dev/null +++ b/.githooks/pre-commit @@ -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 +} diff --git a/modules/shell/git.nix b/modules/shell/git.nix index 8331f4b..3c70752 100644 --- a/modules/shell/git.nix +++ b/modules/shell/git.nix @@ -10,13 +10,12 @@ programs = { git = { enable = true; - hooks.pre-commit = pkgs.writeShellScript "pre-commit" '' - nix fmt . - git diff --exit-code || { - echo "Formatter changed files — review with 'git diff', then re-stage and commit." - exit 1 + includes = [ + { + condition = "gitdir:~/.setup/"; + contents.core.hooksPath = "~/.setup/.githooks"; } - ''; + ]; settings = { user.name = "Kabbone"; user.email = "tobias@opel-online.de";