From 44a69fb376cb54c1469ed6ab2f917a119d42b45f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=E2=80=9CNiols=E2=80=9D=20Jeannerod?= <nicolas.jeannerod@moduscreate.com> Date: Tue, 25 Feb 2025 17:05:45 +0100 Subject: [PATCH] Clean up pre-commit opt-out mechanism --- flake.nix | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/flake.nix b/flake.nix index abbf47d0..fa4ce508 100644 --- a/flake.nix +++ b/flake.nix @@ -33,6 +33,7 @@ { config, pkgs, + lib, inputs', ... }: @@ -44,20 +45,12 @@ ## Add a directory here if pre-commit hooks shouldn't apply to it. optout = [ "npins" ]; excludes = map (dir: "^${dir}/") optout; + addExcludes = lib.mapAttrs (_: c: c // { inherit excludes; }); in - { - nixfmt-rfc-style = { - enable = true; - inherit excludes; - }; - deadnix = { - enable = true; - inherit excludes; - }; - trim-trailing-whitespace = { - enable = true; - inherit excludes; - }; + addExcludes { + nixfmt-rfc-style.enable = true; + deadnix.enable = true; + trim-trailing-whitespace.enable = true; }; devShells.default = pkgs.mkShell {