From dd3cb5e200cc973a3064502df5548bb93c008195 Mon Sep 17 00:00:00 2001 From: Rachit Kumar Verma Date: Mon, 13 Apr 2026 22:18:13 +0530 Subject: [PATCH 1/3] feat(wrapperModules.dprint): init add: Dprint is a code formatter built in rust. More detail in https://dprint.dev/ --- wrapperModules/d/dprint/module.nix | 68 ++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 wrapperModules/d/dprint/module.nix diff --git a/wrapperModules/d/dprint/module.nix b/wrapperModules/d/dprint/module.nix new file mode 100644 index 00000000..34aed789 --- /dev/null +++ b/wrapperModules/d/dprint/module.nix @@ -0,0 +1,68 @@ +{ + wlib, + pkgs, + config, + lib, + ... +}: +let + jsonFormat = pkgs.formats.json { }; + + configJson = config.settings // { + plugins = map (p: "${p}/plugin.wasm") config.plugins; + }; +in +{ + imports = [ wlib.modules.default ]; + + options = { + settings = lib.mkOption { + inherit (jsonFormat) type; + default = { }; + description = '' + Settings to add to dprint.json. + ''; + example = { + excludes = [ + "**/node_modules" + "**/*-lock.json" + ]; + json = { }; + malva = { }; + markdown = { }; + toml = { }; + typescript = { }; + yaml = { }; + }; + }; + + plugins = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = [ ]; + description = '' + Plugins to add to dprint runtime. + ''; + example = lib.literalExpression '' + plugins = with pkgs.dprint-plugins; [ + g-plane-pretty_yaml + dprint-plugin-typescript + dprint-plugin-json + dprint-plugin-markdown + dprint-plugin-toml + g-plane-malva + ]; + ''; + }; + }; + + config = { + package = lib.mkDefault pkgs.dprint; + + constructFiles.generatedConfig = { + relPath = "${config.binName}-config.json"; + content = builtins.toJSON configJson; + }; + + meta.maintainers = [ wlib.maintainers.rachitvrma ]; + }; +} From 036e1c465f3975c70288eff541ea0843366597ec Mon Sep 17 00:00:00 2001 From: Rachit Kumar Verma Date: Tue, 14 Apr 2026 13:55:14 +0530 Subject: [PATCH 2/3] fix(wrapperModules.dprint): add the `--config` flag initially missing `--config` flag --- wrapperModules/d/dprint/module.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wrapperModules/d/dprint/module.nix b/wrapperModules/d/dprint/module.nix index 34aed789..565355e7 100644 --- a/wrapperModules/d/dprint/module.nix +++ b/wrapperModules/d/dprint/module.nix @@ -63,6 +63,10 @@ in content = builtins.toJSON configJson; }; + flag = { + "--config" = config.constructFiles.generatedConfig.path; + }; + meta.maintainers = [ wlib.maintainers.rachitvrma ]; }; } From 9f689281ac9fc10ee75370026ef219323ec1d308 Mon Sep 17 00:00:00 2001 From: Rachit Kumar Verma Date: Tue, 14 Apr 2026 14:02:01 +0530 Subject: [PATCH 3/3] fix:(wrapperModules.dprint): `config.flag` -> `config.flags` --- wrapperModules/d/dprint/module.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrapperModules/d/dprint/module.nix b/wrapperModules/d/dprint/module.nix index 565355e7..f3259370 100644 --- a/wrapperModules/d/dprint/module.nix +++ b/wrapperModules/d/dprint/module.nix @@ -63,7 +63,7 @@ in content = builtins.toJSON configJson; }; - flag = { + flags = { "--config" = config.constructFiles.generatedConfig.path; };