-
Notifications
You must be signed in to change notification settings - Fork 159
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 docs, examples for overriding provided hooks #2
Comments
I'd be perfectly happy to require the YAML to be JSON and DRY it with |
Even better: generate a YAML from with builtins.toJSON. Best: use the module system. |
If this is about download size, I wrote a thing https://github.com/roberth/nix-lazy-env |
Nice! Yes, partially it's about the download size and partially it's for providing additional hooks. |
This seems nice and simple: https://github.com/kampka/pre-commit-hooks |
New - Selectively enable tools (#2) - Make choice of tool versions overridable - User-definable hooks - Input validation at the Nix level Fixes - Stop installing files all over the place when doing nix-shell ../some-project to borrow a tool Cleanup - Get rid of installation code
New - Selectively enable tools (#2) - Make choice of tool versions overridable - User-definable hooks - Input validation at the Nix level Fixes - Stop installing files all over the place when doing nix-shell ../some-project to borrow a tool - Lorri support Cleanup - Get rid of installation code
19: Use the module system r=roberth a=roberth Closes #2 Closes #17 TODO - [x] ~expose and test "core" module set from project.nix~ - [x] ~niv update -b master project.nix when that's done (hercules-ci/project.nix#10 - [x] changelog entry: (elaborate on) translate `.pre-commit-config.yaml` to hooks argument - [x] update README - [x] add how to add a hook to README New - Selectively enable tools (#2) - Make choice of tool versions overridable - User-definable hooks - Input validation at the Nix level - Use gitignore by default Fixes - Stop installing files all over the place when doing nix-shell ../some-project to borrow a tool - Lorri support Cleanup - Get rid of some installation code Co-authored-by: Robert Hensing <[email protected]>
Let's leave this one open as it needs some examples in the docs. |
For what it's worth, I came up with this config to run the black python code formatter: let
nix-pre-commit-hooks = import (builtins.fetchTarball "https://github.com/cachix/pre-commit-hooks.nix/tarball/master");
pkgs = import <nixpkgs> {};
in {
pre-commit-check = nix-pre-commit-hooks.run {
src = ./.;
hooks = {
shellcheck.enable = true;
black = {
enable = true;
name = "black";
description = "Format Python files";
entry = "${pkgs.python3.pkgs.black}/bin/black --check";
types = ["python"];
};
};
};
} That could probably be used as an example. I'm wondering: Why do you use the module-system here? Wouldn't it be easier and more convenient to just use a list of attrsets, with some attrsets pre defined? |
I'll let that @roberth answer, I was also more for simple design of attrsets and defaults. |
With the module system you get
|
Something like:
The text was updated successfully, but these errors were encountered: