forked from Fediversity/Fediversity
Make pre-commits opt-out instead of opt-in
This commit is contained in:
parent
3ec09b491d
commit
142af8d0ee
1 changed files with 7 additions and 17 deletions
24
flake.nix
24
flake.nix
|
@ -41,34 +41,24 @@
|
||||||
formatter = pkgs.nixfmt-rfc-style;
|
formatter = pkgs.nixfmt-rfc-style;
|
||||||
|
|
||||||
pre-commit.settings.hooks =
|
pre-commit.settings.hooks =
|
||||||
## Not everybody might want pre-commit hooks, so we make them
|
|
||||||
## opt-in. Maybe one day we will decide to have them everywhere.
|
|
||||||
let
|
let
|
||||||
inherit (builtins) concatStringsSep;
|
## Add a directory here if pre-commit hooks shouldn't apply to it.
|
||||||
optin = [
|
optout = [ "npins" ];
|
||||||
"deployment"
|
excludes = map (dir: "^${dir}/") optout;
|
||||||
"infra"
|
|
||||||
"keys"
|
|
||||||
"matrix"
|
|
||||||
"secrets"
|
|
||||||
"services"
|
|
||||||
"panel"
|
|
||||||
"website"
|
|
||||||
];
|
|
||||||
files = "^((" + concatStringsSep "|" optin + ")/.*\\.nix|[^/]*\\.nix)$";
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixfmt-rfc-style = {
|
nixfmt-rfc-style = {
|
||||||
enable = true;
|
enable = true;
|
||||||
inherit files;
|
inherit excludes;
|
||||||
};
|
};
|
||||||
deadnix = {
|
deadnix = {
|
||||||
enable = true;
|
enable = true;
|
||||||
inherit files;
|
inherit excludes;
|
||||||
};
|
};
|
||||||
trim-trailing-whitespace = {
|
trim-trailing-whitespace = {
|
||||||
enable = true;
|
enable = true;
|
||||||
inherit files;
|
files = "\\.nix$";
|
||||||
|
inherit excludes;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue