{ pkgs, config, lib, ... }: let inherit (config.grimmShared) enable tooling; inherit (lib) mkOption types mkIf getName mkEnableOption filter ; in { config = mkIf (enable && tooling.enable) { environment.systemPackages = map (v: v.package) tooling.lang_servers; grimmShared.tooling.nvim.extraLuaRC = [ "vim.g.coq_settings = { auto_start = 'shut-up' }" ] ++ (map ( v: "require'lspconfig'.${v.name}.setup(require('coq').lsp_ensure_capabilities(${v.config}))" ) (filter (v: v.vimIntegration) tooling.lang_servers)); grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [ nvim-lspconfig coq_nvim coq-artifacts ]; }; options.grimmShared.tooling.lang_servers = mkOption { type = types.listOf ( types.submodule ( { config, ... }: { options = { name = mkOption { type = types.nullOr types.nonEmptyStr; default = getName config.package; description = "lspconfig module name"; }; config = mkOption { type = types.nonEmptyStr; default = "{}"; description = "options to pass to lspconfig"; }; vimIntegration = mkEnableOption "Enable coq/nvim-lspconfig integration" // { default = true; }; package = mkOption { type = types.package; description = "LSP package"; }; }; } ) ); default = { }; description = "Language servers available on the system"; }; }