-
-
Notifications
You must be signed in to change notification settings - Fork 201
Expand file tree
/
Copy pathlanguages.nix
More file actions
44 lines (39 loc) · 1.21 KB
/
languages.nix
File metadata and controls
44 lines (39 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{lib}: let
inherit (lib.options) mkOption mkPackageOption;
inherit (lib.attrsets) attrNames;
inherit (lib.types) listOf either enum submodule package bool;
diagnosticSubmodule = _: {
options = {
type = mkOption {
description = "Type of diagnostic to enable";
type = attrNames diagnostics;
};
package = mkOption {
type = package;
description = "Diagnostics package";
};
};
};
diagnostics = {
langDesc,
diagnosticsProviders,
defaultDiagnosticsProvider,
}:
mkOption {
type = listOf (either (enum (attrNames diagnosticsProviders)) (submodule diagnosticSubmodule));
default = defaultDiagnosticsProvider;
description = "List of ${langDesc} diagnostics to enable";
};
mkGrammarOption = pkgs: grammar:
mkPackageOption pkgs ["${grammar} treesitter"] {
default = ["vimPlugins" "nvim-treesitter" "builtGrammars" grammar];
};
mkEnableTreesitterOption = defaultCondition: language:
mkOption {
type = bool;
default = defaultCondition;
description = "Whether to enable ${language} treesitter";
};
in {
inherit diagnostics diagnosticSubmodule mkGrammarOption mkEnableTreesitterOption;
}