Skip to content
Merged
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
8 changes: 4 additions & 4 deletions src/modules/integrations/git-hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ let
# This affects all packages built with `buildPythonApplication` or `toPythonApplication`.
# pre-commit is particularly annoying as it is difficult for end-users to track down.
# Tracking: https://github.com/NixOS/nixpkgs/issues/302376
packageBin = pkgs.runCommandLocal "pre-commit-bin" { } ''
packageBin = pkgs.runCommandLocal "pre-commit-bin" { meta.mainProgram = cfg.package.meta.mainProgram; } ''
mkdir -p $out/bin
ln -s ${cfg.package}/bin/pre-commit $out/bin/pre-commit
ln -s ${lib.getExe cfg.package} $out/bin/${cfg.package.meta.mainProgram}
'';

anyEnabled = builtins.any (hook: hook.enable) (lib.attrValues cfg.hooks);
Expand All @@ -35,7 +35,7 @@ in
(git-hooks-module + "/modules/all-modules.nix")
{
rootSrc = self;
package = pkgs.pre-commit;
package = lib.mkDefault pkgs.pre-commit;
tools = import (git-hooks-module + "/nix/call-tools.nix") pkgs;
}
];
Expand Down Expand Up @@ -94,7 +94,7 @@ in
before = [ "devenv:enterShell" ];
};
"devenv:git-hooks:run" = {
exec = "pre-commit run -a";
exec = "${packageBin.meta.mainProgram} run -a";
before = [ "devenv:enterTest" ];
};
};
Expand Down