modules/languages: finish making lib calls explicit

This commit is contained in:
raf 2024-03-09 08:49:22 +03:00
commit dfc7c6737f
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
16 changed files with 301 additions and 217 deletions

View file

@ -5,7 +5,12 @@
...
}: let
inherit (builtins) attrNames;
inherit (lib) mkEnableOption mkOption mkIf mkMerge isList types nvim;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either listOf package str;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.lua) expToLua;
cfg = config.vim.languages.css;
@ -25,7 +30,7 @@
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then nvim.lua.expToLua cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/vscode-css-language-server", "--stdio"}''
}
}
@ -39,7 +44,7 @@ in {
treesitter = {
enable = mkEnableOption "CSS treesitter" // {default = config.vim.languages.enableTreesitter;};
package = nvim.types.mkGrammarOption pkgs "css";
package = mkGrammarOption pkgs "css";
};
lsp = {
@ -47,14 +52,14 @@ in {
server = mkOption {
description = "CSS LSP server to use";
type = with types; enum (attrNames servers);
type = enum (attrNames servers);
default = defaultServer;
};
package = mkOption {
description = "CSS LSP server package, or the command to run as a list of strings";
example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]'';
type = with types; either package (listOf str);
type = either package (listOf str);
default = servers.${cfg.lsp.server}.package;
};
};