flake/pre-commit: check maintainers when modified

This commit is contained in:
Matt Sturgeon 2024-09-07 01:01:17 +01:00
parent 5c929a161f
commit c4135d720a
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -9,7 +9,7 @@
{ {
lib, lib,
pkgs, pkgs,
config, system,
... ...
}: }:
let let
@ -60,11 +60,23 @@
// lib.optionalAttrs (inputs.git-hooks ? flakeModule) { // lib.optionalAttrs (inputs.git-hooks ? flakeModule) {
pre-commit = { pre-commit = {
# We have a treefmt check already, so this is redundant. # We have a treefmt check already, so this is redundant.
# We also can't run the test if it includes running `nix build`,
# since the nix CLI can't build within a derivation builder.
check.enable = false; check.enable = false;
settings.hooks = { settings.hooks = {
treefmt.enable = true; treefmt.enable = true;
typos.enable = true; typos.enable = true;
maintainers = {
enable = true;
name = "maintainers";
description = "Check maintainers when it is modified.";
files = "^lib/maintainers[.]nix$";
package = pkgs.nix;
entry = "nix build --no-link --print-build-logs";
args = [ ".#checks.${system}.maintainers" ];
pass_filenames = false;
};
}; };
}; };
}; };