Skip to content

Commit

Permalink
Add support for nixfmt-rfc-style
Browse files Browse the repository at this point in the history
  • Loading branch information
dasJ committed Aug 28, 2024
1 parent e4b2580 commit 334af94
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ use nix
- [deadnix](https://github.com/astro/deadnix)
- [flake-checker](https://github.com/DeterminateSystems/flake-checker)
- [nil](https://github.com/oxalica/nil)
- [nixfmt](https://github.com/serokell/nixfmt/)
- [nixfmt-classic](https://github.com/NixOS/nixfmt/tree/v0.6.0)
- [nixfmt-rfc-style](https://github.com/NixOS/nixfmt/)
- [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt)
- [statix](https://github.com/nerdypepper/statix)

Expand Down
22 changes: 22 additions & 0 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,20 @@ in
};
};
};
nixfmt-rfc-style = mkOption {
description = "nixfmt (RFC 166 style) hook";
type = types.submodule {
imports = [ hookModule ];
options.settings = {
width =
mkOption {
type = types.nullOr types.int;
description = "Line width.";
default = null;
};
};
};
};
no-commit-to-branch = mkOption {
description = "no-commit-to-branch-hook";
type = types.submodule {
Expand Down Expand Up @@ -2868,6 +2882,14 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
entry = "${hooks.nixfmt.package}/bin/nixfmt ${lib.optionalString (hooks.nixfmt.settings.width != null) "--width=${toString hooks.nixfmt.settings.width}"}";
files = "\\.nix$";
};
nixfmt-rfc-style =
{
name = "nixfmt-rfc-style";
description = "Nix code prettifier (RFC 166 style).";
package = tools.nixfmt-rfc-style;
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}"}";
files = "\\.nix$";
};
nixpkgs-fmt =
{
name = "nixpkgs-fmt";
Expand Down

0 comments on commit 334af94

Please sign in to comment.