diff --git a/README.md b/README.md index 7a834ff3..4c58c63f 100644 --- a/README.md +++ b/README.md @@ -387,6 +387,7 @@ use nix - [deadnix](https://github.com/astro/deadnix) - [flake-checker](https://github.com/DeterminateSystems/flake-checker) - [nil](https://github.com/oxalica/nil) +- [nix-fmt](https://nix.dev/manual/nix/latest/command-ref/new-cli/nix3-fmt) - [nixfmt](https://github.com/NixOS/nixfmt/) (supports `nixfmt` >=v1.0) - [nixfmt-classic](https://github.com/NixOS/nixfmt/tree/v0.6.0) - [nixfmt-rfc-style](https://github.com/NixOS/nixfmt/) diff --git a/modules/hooks.nix b/modules/hooks.nix index 9933d3a5..9f6d5aec 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -3467,6 +3467,13 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm 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 = { name = "nixfmt"; diff --git a/nix/tools.nix b/nix/tools.nix index 50890dfd..e536ce96 100644 --- a/nix/tools.nix +++ b/nix/tools.nix @@ -54,6 +54,7 @@ , mdsh , nbstripout , nil +, nix , nixfmt , nixfmt-classic ? null , nixfmt-rfc-style ? null @@ -162,6 +163,7 @@ in mdsh nbstripout nil + nix nixpkgs-fmt opentofu ormolu