mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
treewide: make lib calls explicit
This commit is contained in:
parent
a7531186a8
commit
974bfcc78e
56 changed files with 589 additions and 496 deletions
|
@ -1,32 +1,37 @@
|
|||
# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix
|
||||
{lib}: {
|
||||
{lib}: let
|
||||
inherit (builtins) isString getAttr;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.attrsets) listToAttrs;
|
||||
inherit (lib.types) bool;
|
||||
in {
|
||||
# Converts a boolean to a yes/no string. This is used in lots of
|
||||
# configuration formats.
|
||||
diagnosticsToLua = {
|
||||
lang,
|
||||
config,
|
||||
diagnostics,
|
||||
diagnosticsProviders,
|
||||
}:
|
||||
lib.listToAttrs
|
||||
listToAttrs
|
||||
(map (v: let
|
||||
type =
|
||||
if builtins.isString v
|
||||
if isString v
|
||||
then v
|
||||
else builtins.getAttr v.type;
|
||||
else getAttr v.type;
|
||||
package =
|
||||
if builtins.isString v
|
||||
then diagnostics.${type}.package
|
||||
if isString v
|
||||
then diagnosticsProviders.${type}.package
|
||||
else v.package;
|
||||
in {
|
||||
name = "${lang}-diagnostics-${type}";
|
||||
value = diagnostics.${type}.nullConfig package;
|
||||
value = diagnosticsProviders.${type}.nullConfig package;
|
||||
})
|
||||
config);
|
||||
|
||||
mkEnable = desc:
|
||||
lib.mkOption {
|
||||
mkOption {
|
||||
description = "Turn on ${desc} for enabled languages by default";
|
||||
type = lib.types.bool;
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue