From c4135d720a5a57b7ddbd7ee918544c26b2c6f732 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sat, 7 Sep 2024 01:01:17 +0100 Subject: [PATCH] flake/pre-commit: check maintainers when modified --- flake-modules/dev/default.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/flake-modules/dev/default.nix b/flake-modules/dev/default.nix index d6f769dc..e8461d28 100644 --- a/flake-modules/dev/default.nix +++ b/flake-modules/dev/default.nix @@ -9,7 +9,7 @@ { lib, pkgs, - config, + system, ... }: let @@ -60,11 +60,23 @@ // lib.optionalAttrs (inputs.git-hooks ? flakeModule) { pre-commit = { # 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; settings.hooks = { treefmt.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; + }; }; }; };