Skip to content

Commit 4509ca6

Browse files
authored
Merge pull request #492 from dasJ/feat/nixfmt-rfc-style
Add support for nixfmt-rfc-style
2 parents e4b2580 + 334af94 commit 4509ca6

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ use nix
149149
- [deadnix](https://github.com/astro/deadnix)
150150
- [flake-checker](https://github.com/DeterminateSystems/flake-checker)
151151
- [nil](https://github.com/oxalica/nil)
152-
- [nixfmt](https://github.com/serokell/nixfmt/)
152+
- [nixfmt-classic](https://github.com/NixOS/nixfmt/tree/v0.6.0)
153+
- [nixfmt-rfc-style](https://github.com/NixOS/nixfmt/)
153154
- [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt)
154155
- [statix](https://github.com/nerdypepper/statix)
155156

modules/hooks.nix

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,20 @@ in
859859
};
860860
};
861861
};
862+
nixfmt-rfc-style = mkOption {
863+
description = "nixfmt (RFC 166 style) hook";
864+
type = types.submodule {
865+
imports = [ hookModule ];
866+
options.settings = {
867+
width =
868+
mkOption {
869+
type = types.nullOr types.int;
870+
description = "Line width.";
871+
default = null;
872+
};
873+
};
874+
};
875+
};
862876
no-commit-to-branch = mkOption {
863877
description = "no-commit-to-branch-hook";
864878
type = types.submodule {
@@ -2868,6 +2882,14 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
28682882
entry = "${hooks.nixfmt.package}/bin/nixfmt ${lib.optionalString (hooks.nixfmt.settings.width != null) "--width=${toString hooks.nixfmt.settings.width}"}";
28692883
files = "\\.nix$";
28702884
};
2885+
nixfmt-rfc-style =
2886+
{
2887+
name = "nixfmt-rfc-style";
2888+
description = "Nix code prettifier (RFC 166 style).";
2889+
package = tools.nixfmt-rfc-style;
2890+
entry = "${hooks.nixfmt-rfc-style.package}/bin/nixfmt ${lib.optionalString (hooks.nixfmt-rfc-style.settings.width != null) "--width=${toString hooks.nixfmt-rfc-style.settings.width}"}";
2891+
files = "\\.nix$";
2892+
};
28712893
nixpkgs-fmt =
28722894
{
28732895
name = "nixpkgs-fmt";

0 commit comments

Comments
 (0)