Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ functions.
* [nixf-diagnose](programs/nixf-diagnose.nix)
* [nixfmt](programs/nixfmt.nix)
* [nixpkgs-fmt](programs/nixpkgs-fmt.nix)
* [nufmt](programs/nufmt.nix)
* [ocamlformat](programs/ocamlformat.nix)
* [odinfmt](programs/odinfmt.nix)
* [opa](programs/opa.nix)
Expand Down
37 changes: 37 additions & 0 deletions programs/nufmt.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
lib,
config,
mkFormatterModule,
...
}:
let
cfg = config.programs.nufmt;
in
{
meta.maintainers = [
"gabyx"
];
Comment thread
gabyx marked this conversation as resolved.

imports = [
(mkFormatterModule {
name = "nufmt";
package = "nufmt";
includes = [ "*.nu" ];
})
];

options.programs.nufmt = {
configFile = lib.mkOption {
type = lib.types.nullOr lib.types.path;
description = "Path to the `nufmt` config file (if needed).";
default = null;
};
};

config = lib.mkIf cfg.enable {
settings.formatter.nufmt.options = lib.optionals (!isNull cfg.configFile) [
"--config"
"${cfg.configFile}"
];
Comment thread
gabyx marked this conversation as resolved.
};
}