Skip to content

Commit

Permalink
Make the generated configuration depend on the pre-commit package
Browse files Browse the repository at this point in the history
Fixes the hooks not updating when the pre-commit package changes but the config doesn't.
  • Loading branch information
K900 committed Jul 27, 2023
1 parent 2ddd4db commit 73954b2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/pre-commit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,12 @@ let
configFile =
runCommand "pre-commit-config.json"
{
buildInputs = [ pkgs.jq ];
buildInputs = [
pkgs.jq
# needs to be an input so we regenerate the config and reinstall the hooks
# when the package changes
cfg.package
];
passAsFile = [ "rawJSON" ];
rawJSON = builtins.toJSON cfg.rawConfig;
} ''
Expand Down

0 comments on commit 73954b2

Please sign in to comment.