diff --git a/README.md b/README.md index 8abb7b6d..c94ff3eb 100644 --- a/README.md +++ b/README.md @@ -474,6 +474,10 @@ hooks](modules/pre-commit.nix). - [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt) - [statix](https://github.com/nerdypepper/statix) +### Nushell + +- [nufmt](https://github.com/nushell/nufmt) + ### OCaml - [dune-fmt](https://dune.build/) diff --git a/modules/hooks.nix b/modules/hooks.nix index e27bb4e8..01f4342a 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -1071,6 +1071,19 @@ in }; }; }; + nufmt = mkOption { + description = "nufmt hook"; + type = types.submodule { + imports = [ hookModule ]; + options.settings = { + configPath = mkOption { + type = types.nullOr types.path; + description = "Path to the nufmt.nuon configuration file."; + default = null; + }; + }; + }; + }; ormolu = mkOption { description = "ormolu hook"; type = types.submodule { @@ -3648,6 +3661,22 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm in "${hooks.no-commit-to-branch.package}/bin/no-commit-to-branch ${cmdArgs}"; }; + nufmt = + { + name = "nufmt"; + description = "Nushell code formatter."; + package = tools.nufmt; + entry = + let + cmdArgs = + mkCmdArgs + (with hooks.nufmt.settings; [ + [ (configPath != null) "--config ${configPath}" ] + ]); + in + "${lib.getExe hooks.nufmt.package} ${cmdArgs}"; + types = [ "nushell" ]; + }; ocp-indent = { name = "ocp-indent"; @@ -4016,6 +4045,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm [ (configuration != { }) " --config ${toml.generate ".rumdl.toml" configuration}" ] ]); in + { name = "rumdl"; description = "Style checker and linter for rumdl files."; diff --git a/nix/tools.nix b/nix/tools.nix index 5c0fb1f1..20c157c0 100644 --- a/nix/tools.nix +++ b/nix/tools.nix @@ -58,6 +58,7 @@ , nixfmt-classic ? placeholder "nixfmt-classic" , nixfmt-rfc-style ? placeholder "nixfmt-rfc-style" , nixpkgs-fmt +, nufmt ? placeholder "nufmt" , nodePackages , ocamlPackages , opam @@ -166,6 +167,7 @@ in nil nixf-diagnose nixpkgs-fmt + nufmt opam opentofu ormolu