2023-10-22 15:10:28 +00:00
|
|
|
# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix
|
2023-04-17 20:27:27 +00:00
|
|
|
{lib}: {
|
2023-10-22 15:10:28 +00:00
|
|
|
# Converts a boolean to a yes/no string. This is used in lots of
|
|
|
|
# configuration formats.
|
2023-04-17 20:27:27 +00:00
|
|
|
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 15:36:25 +00:00
|
|
|
|
|
|
|
mkEnable = desc:
|
|
|
|
lib.mkOption {
|
|
|
|
description = "Turn on ${desc} for enabled languages by default";
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = false;
|
|
|
|
};
|
2023-04-17 20:27:27 +00:00
|
|
|
}
|