Open MatrixManAtYrService opened 1 year ago
A more general application of this pattern would be to override cases like this:
- repo: local
hooks:
- id: foo
language: system
entry: python ./somescript.py
So that you can map them to declared environments, rather than using whatever pre-commit comes up with for "system"
Has anyone found a solution for this already? I don't want to necessarily overwrite, but at least keep the existing .pre-commit-hook.yaml for non-nix collaborators
It's currently hardcoded, but I suppose with some hacking (on this repo) the location could be turned into an option
I think you can pass an alternate config location to pre-commit as well.
I see that there is already an issue for documenting how to "override" a hook. I also want to override a hook, but I think we mean "override" in different ways.
Most of my team doesn't use nix, so they run pre-commit against a
.pre-commit-hooks.yaml
which I would be frowned at if I deleted and.gitignored
as this warning recommends:I maintain a flake.nix in my team's repo because I appreciate the determinism, especially when switching between machines. This comes with certain headaches like this one. Since
charliermarsh/ruff-pre-commit
breaks on NixOS but works for my non-nix coworkers, I'd like to do the following.A: contribute a
ruff
pre-commit hook to pre-commit-hooks.nix B: configure pre-commit-hooks.nix to run the nix-friendly hook instead ofcharliermarsh/ruff-pre-commit
, but otherwise conform to the existing hooks C: commit this configuration to my repo in a way that does not break my non-nix coworker's workflowsSo when I say "override" I mean:
Can I get some advice on whether pre-commit-hooks.nix is capable of supporting B and C? If so, how would I configure it?