Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/modules/integrations/claude.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,11 @@ let
})
hooks;

# Check if git-hooks task is defined (indicates git-hooks are enabled)
anyGitHooksEnabled = (config.tasks."devenv:git-hooks:run".exec or null) == "pre-commit run -a";

# Auto-format hook using pre-commit if any git-hooks are enabled
preCommitHook = lib.optional anyGitHooksEnabled {
# Auto-format hook using git-hooks if enabled
preCommitHook = lib.optional config.git-hooks.enable {
matcher = "^(Edit|MultiEdit|Write)$";
command = ''
cd "$DEVENV_ROOT" && pre-commit run
cd "$DEVENV_ROOT" && ${config.git-hooks.package.meta.mainProgram} run
'';
};

Expand Down Expand Up @@ -640,7 +637,7 @@ in
''
Claude Code integration is enabled with automatic hooks and commands setup.
Settings are configured at: ${cfg.settingsPath}
${lib.optionalString anyGitHooksEnabled "- Auto-formatting: enabled via git-hooks (pre-commit)"}
${lib.optionalString config.git-hooks.enable "- Auto-formatting: enabled via git-hooks (pre-commit)"}
${lib.optionalString (cfg.commands != { })
"- Project commands: ${
lib.concatStringsSep ", " (map (cmd: "/${cmd}") (lib.attrNames cfg.commands))
Expand Down
14 changes: 13 additions & 1 deletion src/modules/integrations/git-hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ let
(git-hooks + "/modules/all-modules.nix")
{
rootSrc = self;
package = lib.mkDefault pkgs.pre-commit;
package = lib.mkDefault pkgs.prek;
tools = import (git-hooks + "/nix/call-tools.nix") pkgs;
}
];
Expand Down Expand Up @@ -88,6 +88,18 @@ in
};

config = lib.mkMerge [
{
changelogs = [
{
date = "2026-02-02";
title = "git-hooks.package is now pkgs.prek";
when = cfg.enable;
description = ''
The default package for git-hooks has been changed from `pkgs.pre-commit` to `pkgs.prek`.
'';
}
];
}
# Auto-enable when any hook is enabled, so other modules can check git-hooks.enable
{
git-hooks.enable = lib.mkDefault anyHookEnabled;
Expand Down
Loading