Skip to content

Commit

Permalink
Add nix fmt hook
Browse files Browse the repository at this point in the history
fixes: cachix#287
  • Loading branch information
shikanime committed Oct 10, 2024
1 parent 4e743a6 commit d82a37a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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-fmt.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;
Expand Down
2 changes: 2 additions & 0 deletions nix/tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
, mdl
, mdsh
, nil
, nix
, nixfmt
, nixfmt-classic ? null
, nixfmt-rfc-style ? null
Expand Down Expand Up @@ -134,6 +135,7 @@ in
mdl
mdsh
nil
nix
nixpkgs-fmt
ormolu
pre-commit-hook-ensure-sops
Expand Down

0 comments on commit d82a37a

Please sign in to comment.