Skip to content

Commit

Permalink
Merge pull request #492 from dasJ/feat/nixfmt-rfc-style
Browse files Browse the repository at this point in the history
Add support for nixfmt-rfc-style
  • Loading branch information
domenkozar authored Aug 28, 2024
2 parents e4b2580 + 334af94 commit 4509ca6
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 4509ca6

Please sign in to comment.