-
Notifications
You must be signed in to change notification settings - Fork 339
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
Question: how to add a custom pre-commit-hook as a devenv module? #694
Comments
I'm looking for something similar here: #664 |
Hey :) I agree we need to write docs how to write modules. Let me know if this is blocking you! |
In my case, it's not blocking me per se, but it would be nice to start experimenting with custom modules and throw out some boilerplate in some of the projects I use devenv in. If you have a quick example somewhere that would really be helpful. Thanks! |
An example for pre-commit: { pkgs, ... }: {
# Example custom hook for a C project using Make:
pre-commit.hooks.unit-tests = {
enable = true;
# The name of the hook (appears on the report table):
name = "Unit tests";
# The command to execute (mandatory):
entry = "make check";
# The pattern of files to run on (default: "" (all))
# see also https://pre-commit.com/#hooks-files
files = "\\.(c|h)$";
# List of file types to run on (default: [ "file" ] (all files))
# see also https://pre-commit.com/#filtering-files-with-types
# You probably only need to specify one of `files` or `types`:
types = [ "text" "c" ];
# Exclude files that were matched by these patterns (default: [ ] (none)):
excludes = [ "irrelevant\\.c" ];
# The language of the hook - tells pre-commit
# how to install the hook (default: "system")
# see also https://pre-commit.com/#supported-languages
language = "system";
# Set this to false to not pass the changed files
# to the command (default: true):
pass_filenames = false;
};
} |
Hello there 👋,
I'm trying to create a devenv module that extends the list of pre-commit-hooks available in the
pre-commit.hooks
option.I tried to create a submodule override for the pre-commit submodule, but that didn't work.
I'm unfamiliar with how we can add a module system inside another, and I'm probably doing something wrong.
Could you please help me here? I appreciate any pointers you can give me.
The text was updated successfully, but these errors were encountered: