language/nim: migrate to conform/nvim-lint

This commit is contained in:
Ching Pei Yang 2025-03-27 20:14:05 +01:00
parent ab5dbb263e
commit e0bcd93bea
No known key found for this signature in database
GPG key ID: B3841364253DC4C8

View file

@ -6,6 +6,7 @@
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either listOf package str;
@ -38,14 +39,9 @@
formats = {
nimpretty = {
package = pkgs.nim;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.nimpretty.with({
command = "${pkgs.nim}/bin/nimpretty",
})
)
'';
config = {
command = "${cfg.format.package}/bin/nimpretty";
};
};
};
in {
@ -110,8 +106,11 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.nim-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.nim = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
};
})
]);
}