language/hcl: migrate to conform/nvim-lint

This commit is contained in:
Ching Pei Yang 2025-03-27 20:10:30 +01:00
parent 856b064a19
commit b24999300b
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.types) package bool enum;
inherit (lib.nvim.types) mkGrammarOption;
@ -30,14 +31,6 @@
formats = {
hclfmt = {
package = pkgs.hclfmt;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.hclfmt.with({
command = "${lib.getExe cfg.format.package}",
})
)
'';
};
};
in {
@ -110,8 +103,13 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.hcl-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.hcl = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
]);
}