From 8a8d2b81f465bb693c676a285f1ba93b4d3a8931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 9 Dec 2024 15:35:22 +0100 Subject: [PATCH 1/3] make sure that clang-tools is in the same version across all platforms We noticed when upgrading nixpkgs in nix, that clang-format would produce different results on macOS vs Linux. This is not great behaviour especially in CI, because you cannot win. This is because llvmPackage might be in a different version. To solve this, we now always depend on the latest version. --- nix/tools.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/tools.nix b/nix/tools.nix index c21d3987..7bcfda95 100644 --- a/nix/tools.nix +++ b/nix/tools.nix @@ -11,7 +11,7 @@ , callPackage , cargo , checkmake -, clang-tools +, llvmPackages_latest , clippy , cljfmt , cmake-format @@ -96,6 +96,7 @@ let }; in { + clang-tools = llvmPackages_latest.clang-tools; inherit actionlint alejandra @@ -106,7 +107,6 @@ in cabal-fmt cabal-gild cargo - clang-tools clippy cljfmt cmake-format From 2c69d710c20b8856e18d01fd4f6d265175167eec Mon Sep 17 00:00:00 2001 From: Rohit Singh Date: Sun, 15 Dec 2024 02:03:15 +0530 Subject: [PATCH 2/3] chore: add a default priority to `cabal2nix` which ensures it runs after `hpack` --- modules/hooks.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/hooks.nix b/modules/hooks.nix index 85753fd1..8f8b6f71 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -2038,6 +2038,7 @@ in package = tools.cabal2nix-dir; entry = "${hooks.cabal2nix.package}/bin/cabal2nix-dir"; files = "\\.cabal$"; + after = [ "hpack" ]; }; cargo-check = { From 3e7d791061be477b20a9d4e1f57872a51a392a57 Mon Sep 17 00:00:00 2001 From: Daniel Baker Date: Sat, 14 Dec 2024 23:55:08 -0800 Subject: [PATCH 3/3] bugfix: remove before/after options from config json file A recent commit to add ordering priority to the hooks introduced new keys into the pre-commit JSON config file. These keys should not be there are they are not keys pre-commit is aware of and produce warning messages. e.g.: ``` [WARNING] Unexpected key(s) present on local => treefmt: after, before ``` This commit fixes it by filter out all keys with names `before` or `after`, in Nix, before writing the configuration to file. Fixes https://github.com/cachix/git-hooks.nix/issues/112 --- modules/pre-commit.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/pre-commit.nix b/modules/pre-commit.nix index 8ad81104..a9b2b2ba 100644 --- a/modules/pre-commit.nix +++ b/modules/pre-commit.nix @@ -9,6 +9,7 @@ let mapAttrsToList mkOption types + removeAttrs remove ; @@ -43,8 +44,15 @@ let ) enabledHooks ); + cleanedHooks = builtins.map ( + hook: + removeAttrs hook [ + "before" + "after" + ] + ) sortedHooks.result; in - sortedHooks.result; + cleanedHooks; configFile = performAssertions (