From 61669ed40cf80a990ec3fad05d9e426d3123096d Mon Sep 17 00:00:00 2001 From: Nicolas Erni Date: Thu, 12 Jun 2025 12:04:41 +0200 Subject: [PATCH] Use the manual hook stage if it exists in the list Otherwise, installStages = [ "pre-push" "manual" ] will not use a --hook-stage and use the commit stage. In pre-commit the commit stage is the default hook stage --- modules/pre-commit.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/pre-commit.nix b/modules/pre-commit.nix index b340b62a..d2de321d 100644 --- a/modules/pre-commit.nix +++ b/modules/pre-commit.nix @@ -3,7 +3,7 @@ let inherit (lib) boolToString concatStringsSep - compare + elem filterAttrs literalExample mapAttrsToList @@ -101,7 +101,7 @@ let git config --global user.email "you@example.com" git config --global user.name "Your Name" git commit -m "init" -q - if [[ ${toString (compare cfg.installStages [ "manual" ])} -eq 0 ]] + if [[ '${toString (elem "manual" cfg.installStages)}' -eq '1' ]] then echo "Running: $ pre-commit run --hook-stage manual --all-files" pre-commit run -c ${cfg.configPath} --hook-stage manual --all-files