-
Notifications
You must be signed in to change notification settings - Fork 175
Make hook installation optional #261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
212f93c
to
6c08a5c
Compare
I'm confused why this is needed, can't you make the call to pre-commit |
I don't think The goal is to let a project choose not to install any hooks into .git by default, unless the devShell user has opted in. |
…nstead of $GIT_WC
pre-commit did not pick up on the .sh extension because of types_or. This should be fixed properly somehow, but that's out of scope for this commit and branch.
6c08a5c
to
af4ad11
Compare
I've re-done it. This time it just (cleanly) refactors the existing logic, so that it can be called without installing the hooks into |
# `types_or = [ ... something ... ]` doesn't pick up our .sh file | ||
shellcheck.types_or = nixpkgs.lib.mkForce [ ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't have been necessary, but that's a different problem; not for this PR.
@roberth I'd love to have this. Are you willing to refresh your PR? |
Sorry for the mess, we revamed module structure in #397, could you port these changes over? |
Closing as outdated |
Is the functionality request outdated or just the state of the PR? Is there a replacement? |
I think having |
A highly opinionated workflow doesn't work for all projects, especially ones that already have a long history, notably NixOS/nix. Some people hate pre-commit with a passion.
These things should not be showstoppers.
To quote the docs:
Opting out, opting in
Users can enforce their own preference by setting
NIX_PRE_COMMIT_HOOKS_INSTALL
to0
or1
in their environment, e.g. in.profile
or inhome.sessionVariables
for home-manager users.Furthermore, project maintainers can set a default preference via the
installByDefault
option.Finally, regardless of these settings, you may install the hooks manually by running
nix-pre-commit-hooks-install
in your shell. This does what it says, and the shell hook will detect that the hooks exist and keep them up to date.