You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running various flake.nix inside a large monorepo, and each of these flake.nix configures a pre-commit-hook for that specific sub-project of the monorepo.
I would like the hook to override the .pre-commit-config.yaml of other flakes whenever I do a nix develop, is there a way to do this? And if not, would you be willing to support it?
The text was updated successfully, but these errors were encountered:
I have worked around this issue by overriding the shellHook phase of pre-commit.devShell to first delete the .pre-commit-config.yaml file at the git root. Maybe this is also useful to you? :)
(config.pre-commit.devShell.overrideAttrs (old: {
shellHook =
let
# delete the local `.pre-commit-config.yaml` file before creating it again.
# this prevents the pre-commit hooks from updating when loading a development
# environment of a sub-project
delete-old-pre-commit-config = pkgs.writeShellScriptBin "delete-old-pre-commit-config" ''
export root=$(${lib.getExe pkgs.git} rev-parse --show-toplevel)
${lib.getExe' pkgs.toybox "rm"} -f $root/.pre-commit-config.yaml
'';
in
''
${lib.getExe delete-old-pre-commit-config}
''
+ old.shellHook;
}))
Hello there,
I'm running various
flake.nix
inside a large monorepo, and each of theseflake.nix
configures a pre-commit-hook for that specific sub-project of the monorepo.I would like the hook to override the
.pre-commit-config.yaml
of other flakes whenever I do anix develop
, is there a way to do this? And if not, would you be willing to support it?The text was updated successfully, but these errors were encountered: