2022-09-18 11:19:23 +01:00
|
|
|
{
|
2023-02-20 11:42:13 +01:00
|
|
|
lib,
|
2023-11-06 15:04:08 +01:00
|
|
|
helpers,
|
2023-02-20 11:42:13 +01:00
|
|
|
config,
|
2023-11-06 15:04:08 +01:00
|
|
|
pkgs,
|
2023-02-20 11:42:13 +01:00
|
|
|
...
|
|
|
|
}:
|
2024-03-13 17:04:45 +01:00
|
|
|
with lib;
|
|
|
|
helpers.neovim-plugin.mkNeovimPlugin config {
|
|
|
|
name = "coq-nvim";
|
|
|
|
originalName = "coq_nvim";
|
|
|
|
defaultPackage = pkgs.vimPlugins.coq_nvim;
|
2022-01-09 23:00:19 +00:00
|
|
|
|
2024-03-13 17:04:45 +01:00
|
|
|
maintainers = [maintainers.traxys];
|
2023-01-19 10:45:15 +00:00
|
|
|
|
2024-03-13 17:04:45 +01:00
|
|
|
extraOptions = {
|
2023-10-09 07:58:51 -05:00
|
|
|
installArtifacts = mkEnableOption "and install coq-artifacts";
|
2024-03-13 17:04:45 +01:00
|
|
|
artifactsPackage = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
description = "Package to use for coq-artifacts (when enabled with installArtifacts)";
|
|
|
|
default = pkgs.vimPlugins.coq-artifacts;
|
2022-01-09 23:00:19 +00:00
|
|
|
};
|
2024-03-13 17:04:45 +01:00
|
|
|
};
|
2022-01-09 23:00:19 +00:00
|
|
|
|
2024-03-13 17:04:45 +01:00
|
|
|
# TODO: Introduced 12-03-2022, remove 12-05-2022
|
|
|
|
optionsRenamedToSettings = [
|
|
|
|
"xdg"
|
|
|
|
"autoStart"
|
|
|
|
];
|
|
|
|
imports = let
|
|
|
|
basePath = ["plugins" "coq-nvim"];
|
|
|
|
settingsPath = basePath ++ ["settings"];
|
|
|
|
in [
|
|
|
|
(
|
|
|
|
mkRenamedOptionModule
|
|
|
|
(basePath ++ ["recommendedKeymaps"])
|
|
|
|
(settingsPath ++ ["keymap" "recommended"])
|
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
mkRenamedOptionModule
|
|
|
|
(basePath ++ ["alwaysComplete"])
|
|
|
|
(settingsPath ++ ["completion" "always"])
|
|
|
|
)
|
|
|
|
];
|
|
|
|
|
|
|
|
callSetup = false;
|
|
|
|
settingsOptions = {
|
|
|
|
auto_start =
|
|
|
|
helpers.mkNullOrOption
|
|
|
|
(with helpers.nixvimTypes; maybeRaw (either bool (enum ["shut-up"])))
|
|
|
|
"Auto-start or shut up";
|
2023-11-30 16:34:58 +01:00
|
|
|
|
2024-03-13 17:04:45 +01:00
|
|
|
xdg = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = "Use XDG paths. May be required when installing coq with Nix.";
|
2023-11-30 16:34:58 +01:00
|
|
|
};
|
2024-03-13 17:04:45 +01:00
|
|
|
|
|
|
|
keymap.recommended = helpers.defaultNullOpts.mkBool true "Use the recommended keymaps";
|
|
|
|
|
|
|
|
completion.always = helpers.defaultNullOpts.mkBool true "Always trigger completion on keystroke";
|
2022-01-09 23:00:19 +00:00
|
|
|
};
|
2024-03-13 17:04:45 +01:00
|
|
|
|
|
|
|
extraConfig = cfg: {
|
|
|
|
extraPlugins = mkIf cfg.installArtifacts [
|
|
|
|
cfg.artifactsPackage
|
|
|
|
];
|
|
|
|
|
2022-01-09 23:00:19 +00:00
|
|
|
plugins.lsp = {
|
|
|
|
preConfig = ''
|
2024-03-13 17:04:45 +01:00
|
|
|
vim.g.coq_settings = ${helpers.toLuaObject cfg.settings}
|
2022-01-09 23:00:19 +00:00
|
|
|
local coq = require 'coq'
|
|
|
|
'';
|
2023-02-20 11:42:13 +01:00
|
|
|
setupWrappers = [(s: ''coq.lsp_ensure_capabilities(${s})'')];
|
2022-01-09 23:00:19 +00:00
|
|
|
};
|
|
|
|
};
|
2024-03-13 17:04:45 +01:00
|
|
|
}
|