Skip to content
Open
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
68 changes: 68 additions & 0 deletions wrapperModules/d/dprint/module.nix
Original file line number Diff line number Diff line change
@@ -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;

Copy link
Copy Markdown
Owner

@BirdeeHub BirdeeHub Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the package actually learning about our config file?

We constructed it. But I don't see us doing anything with it?

Copy link
Copy Markdown
Contributor Author

@rachitvrma rachitvrma Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. Fixed now.

constructFiles.generatedConfig = {
relPath = "${config.binName}-config.json";
content = builtins.toJSON configJson;
};

meta.maintainers = [ wlib.maintainers.rachitvrma ];
};
}