From fb00e51e0106c697c3898a0e128a2c87b77d9b33 Mon Sep 17 00:00:00 2001 From: William Phetsinorath Date: Thu, 10 Oct 2024 19:53:28 +0200 Subject: [PATCH] Add nix fmt hook fixes: https://github.com/cachix/git-hooks.nix/issues/287 --- modules/hooks.nix | 7 +++++++ nix/tools.nix | 2 ++ 2 files changed, 9 insertions(+) diff --git a/modules/hooks.nix b/modules/hooks.nix index 10d2c577..e4daa7f4 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -2894,6 +2894,13 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol builtins.toString script; files = "\\.nix$"; }; + nix-fmt = + { + name = "nix-fmt"; + description = "Format Nix files using the formatter specified in your flake."; + package = tools.nix; + entry = "${hooks.nix.package}/bin/nix fmt"; + }; # nixfmt was renamed to nixfmt-classic. # The hook has been deprecated to free up the name for when the new RFC-style nixfmt becomes stable. nixfmt = nixfmt-classic; diff --git a/nix/tools.nix b/nix/tools.nix index 10d97fc3..6bc9d4c7 100644 --- a/nix/tools.nix +++ b/nix/tools.nix @@ -44,6 +44,7 @@ , mdl , mdsh , nil +, nix , nixfmt , nixfmt-classic ? null , nixfmt-rfc-style ? null @@ -134,6 +135,7 @@ in mdl mdsh nil + nix nixpkgs-fmt ormolu pre-commit-hook-ensure-sops