mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-01 19:11:15 +00:00
26 lines
675 B
Nix
26 lines
675 B
Nix
# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix
|
|
{lib}: {
|
|
# Converts a boolean to a yes/no string. This is used in lots of
|
|
# configuration formats.
|
|
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);
|
|
}
|