2022-01-09 23:00:19 +00:00
|
|
|
{ pkgs, lib, config, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
2022-09-18 11:19:23 +01:00
|
|
|
cfg = config.plugins.coq-nvim;
|
2022-01-09 23:00:19 +00:00
|
|
|
helpers = import ../helpers.nix { lib = lib; };
|
|
|
|
plugins = import ../plugin-defs.nix { inherit pkgs; };
|
|
|
|
|
2022-09-18 11:19:23 +01:00
|
|
|
in
|
|
|
|
{
|
2022-01-09 23:00:19 +00:00
|
|
|
options = {
|
2022-09-18 11:19:23 +01:00
|
|
|
plugins.coq-nvim = {
|
2022-01-09 23:00:19 +00:00
|
|
|
enable = mkEnableOption "Enable coq-nvim";
|
|
|
|
|
2023-01-19 10:45:15 +00:00
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.vimPlugins.coq-nvim;
|
|
|
|
description = "Plugin to use for coq-nvim";
|
|
|
|
};
|
|
|
|
|
2022-01-09 23:00:19 +00:00
|
|
|
installArtifacts = mkEnableOption "Install coq-artifacts";
|
|
|
|
|
|
|
|
autoStart = mkOption {
|
2022-09-18 11:19:23 +01:00
|
|
|
type = with types; nullOr (oneOf [ bool (enum [ "shut-up" ]) ]);
|
2022-01-09 23:00:19 +00:00
|
|
|
default = null;
|
|
|
|
description = "Auto-start or shut up";
|
|
|
|
};
|
|
|
|
|
|
|
|
recommendedKeymaps = mkOption {
|
|
|
|
type = with types; nullOr bool;
|
|
|
|
default = null;
|
|
|
|
description = "Use the recommended keymaps";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-09-18 11:19:23 +01:00
|
|
|
config =
|
|
|
|
let
|
|
|
|
settings = {
|
|
|
|
auto_start = cfg.autoStart;
|
|
|
|
"keymap.recommended" = cfg.recommendedKeymaps;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
mkIf cfg.enable {
|
2022-01-09 23:00:19 +00:00
|
|
|
extraPlugins = [
|
2023-01-19 10:45:15 +00:00
|
|
|
cfg.package
|
2022-01-09 23:00:19 +00:00
|
|
|
] ++ optional cfg.installArtifacts plugins.coq-artifacts;
|
|
|
|
plugins.lsp = {
|
|
|
|
preConfig = ''
|
|
|
|
vim.g.coq_settings = ${helpers.toLuaObject settings}
|
|
|
|
local coq = require 'coq'
|
|
|
|
'';
|
2022-09-18 11:19:23 +01:00
|
|
|
setupWrappers = [ (s: ''coq.lsp_ensure_capabilities(${s})'') ];
|
2022-01-09 23:00:19 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|