This commit is contained in:
2026-02-05 16:04:00 +01:00
parent 53cf49f158
commit 4ac16cedc4
5 changed files with 151 additions and 22 deletions

View File

@@ -0,0 +1,22 @@
{ config, lib, ... }:
{
options.services.git-hooks = {
enable = lib.mkEnableOption "Install git hooks for Nix flake";
flake-path = lib.mkOption {
type = lib.types.path;
description = "Path to Nix flake repository";
};
};
config = lib.mkIf config.services.git-hooks.enable {
system.activationScripts.git-hooks = lib.stringAfter [ "users" ] ''
if [ -d "${config.services.git-hooks.flake-path}/.git" ]; then
echo "🪝 Installing git hooks..."
cd ${config.services.git-hooks.flake-path}
nix run .#apps.x86_64-linux.pre-commit-install || true
echo " Done"
fi
'';
};
}