-
Notifications
You must be signed in to change notification settings - Fork 155
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
Add extraPackages
to each hook and propagate them to enabledPackages
#430
Conversation
This lets additional runtime packages like formatters for `treefmt` be propagated to `enabledPackages` for use in a developer environment.
Shouldn't we just propagate |
I'm also not quite sure how that would work with e.g. |
We should remove It's sole purpose is to provide an access point to override specific dependencies for hooks that have them. And the reason it's an attrset and not a list of packages (like
Yeah, @domenkozar, I quite like this actually. |
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.
LGTM!
The only question I have is whether we might want to mark this as internal
? But then it won't show up in the docs at all, which is annoying if you're writing a custom hook. 🤷 Probably good as it is.
I've argued for a category of "advanced" options, a middle ground, but that's controversial, in the context of NixOS at least. |
We could also replace |
That's what we're doing now, no? Or do you have something else in mind? git-hooks.nix/modules/hooks.nix Lines 176 to 185 in 40e6053
|
Co-authored-by: sander <[email protected]>
Oh, I see. I thought it was an arbitrary attrset of packages for some reason. Maybe we should remove the |
Maybe 🤷 The extra level excludes the (admittedly unlikely) possibility of naming conflicts with other pre-commit options. |
enabledPackages
can be used to include all the relevant packages for enabled hooks into a developer environment. Unfortunately, it doesn't automatically pick up on packages other than a hook's defaultpackage
attribute. By adding anextraPackages
option to each hook, these other packages can be seamlessly added to developer environments.I've included defaults for
extraPackages
for the following hooks:treefmt
: the enabledsettings.formatters
clippy
,rustfmt
: thepackageOverrides
dune-fmt
: the enabledsettings.extraRuntimeInputs