neovim-flake/lib/languages.nix

30 lines
647 B
Nix
Raw Normal View History

{lib}: {
diagnosticsToLua = {
lang,
config,
diagnostics,
}:
lib.listToAttrs
(map (v: let
type =
if builtins.isString v
then v
else builtins.getAttr v.type;
package =
if builtins.isString v
then diagnostics.${type}.package
else v.package;
in {
name = "${lang}-diagnostics-${type}";
value = diagnostics.${type}.nullConfig package;
})
config);
2023-09-23 17:36:25 +02:00
mkEnable = desc:
lib.mkOption {
description = "Turn on ${desc} for enabled languages by default";
type = lib.types.bool;
default = false;
};
}