mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-22 17:03:31 +02:00
plugins/copilot-vim: switch to using mkPlugin
This commit is contained in:
parent
6e39178dd3
commit
bc0886c6bb
1 changed files with 39 additions and 54 deletions
|
@ -1,63 +1,48 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
|
||||||
config,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
} @ args:
|
||||||
with lib; let
|
with lib;
|
||||||
cfg = config.plugins.copilot-vim;
|
(
|
||||||
in {
|
with import ../helpers.nix {inherit lib;};
|
||||||
imports = [
|
mkPlugin args {
|
||||||
(lib.mkRenamedOptionModule ["plugins" "copilot"] ["plugins" "copilot-vim"])
|
name = "copilot-vim";
|
||||||
];
|
description = "copilot.vim";
|
||||||
|
package = pkgs.vimPlugins.copilot-vim;
|
||||||
|
globalPrefix = "copilot_";
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
plugins.copilot-vim = {
|
nodeCommand = mkDefaultOpt {
|
||||||
enable = mkEnableOption "copilot.vim";
|
global = "node_command";
|
||||||
|
type = types.str;
|
||||||
|
default = "${pkgs.nodejs-18_x}/bin/node";
|
||||||
|
description = "Tell Copilot what `node` binary to use.";
|
||||||
|
};
|
||||||
|
|
||||||
package = helpers.mkPackageOption "copilot.vim" pkgs.vimPlugins.copilot-vim;
|
filetypes = mkDefaultOpt {
|
||||||
|
type = with types; attrsOf bool;
|
||||||
|
description = ''
|
||||||
|
A dictionary mapping file types to their enabled status
|
||||||
|
|
||||||
filetypes = mkOption {
|
Default: `{}`
|
||||||
type = types.attrsOf types.bool;
|
'';
|
||||||
description = "A dictionary mapping file types to their enabled status";
|
|
||||||
default = {};
|
|
||||||
example = {
|
example = {
|
||||||
"*" = false;
|
"*" = false;
|
||||||
python = true;
|
python = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
proxy = helpers.defaultNullOpts.mkStr "" ''
|
proxy = mkDefaultOpt {
|
||||||
Tell Copilot what proxy server to use.
|
type = types.str;
|
||||||
Example: "localhost:3128"
|
description = "Tell Copilot what proxy server to use.";
|
||||||
'';
|
example = "localhost:3128";
|
||||||
|
|
||||||
extraConfig = mkOption {
|
|
||||||
type = types.attrs;
|
|
||||||
description = ''
|
|
||||||
The configuration options for copilot without the 'copilot_' prefix.
|
|
||||||
Example: To set 'copilot_foo_bar' to 1, write
|
|
||||||
extraConfig = {
|
|
||||||
foo_bar = true;
|
|
||||||
};
|
|
||||||
'';
|
|
||||||
default = {};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
extraPlugins = [cfg.package];
|
|
||||||
|
|
||||||
globals = with cfg;
|
|
||||||
mapAttrs' (name: nameValuePair ("copilot_" + name))
|
|
||||||
(
|
|
||||||
{
|
|
||||||
node_command = "${pkgs.nodejs-18_x}/bin/node";
|
|
||||||
inherit filetypes proxy;
|
|
||||||
}
|
}
|
||||||
// cfg.extraConfig
|
)
|
||||||
);
|
// {
|
||||||
};
|
imports = [
|
||||||
}
|
(lib.mkRenamedOptionModule ["plugins" "copilot"] ["plugins" "copilot-vim"])
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue