test
This commit is contained in:
22
modules/git-hooks/default.nix
Normal file
22
modules/git-hooks/default.nix
Normal 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
|
||||
'';
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user