mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-23 09:18:38 +02:00
plugins/codeium-nvim: migrate to mkNeovimPlugin
This commit is contained in:
parent
c8328e6d59
commit
b072a4a68f
3 changed files with 103 additions and 66 deletions
|
@ -1,85 +1,122 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
|
||||||
let
|
let
|
||||||
cfg = config.plugins.codeium-nvim;
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
in
|
in
|
||||||
{
|
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
name = "codeium-nvim";
|
||||||
|
originalName = "codeium.nvim";
|
||||||
|
luaName = "codeium";
|
||||||
|
|
||||||
options.plugins.codeium-nvim = helpers.neovim-plugin.extraOptionsOptions // {
|
maintainers = with lib.maintainers; [
|
||||||
configPath = helpers.defaultNullOpts.mkStr {
|
GaetanLepage
|
||||||
|
khaneliman
|
||||||
|
];
|
||||||
|
|
||||||
|
# TODO: added 2024-09-03 remove after 24.11
|
||||||
|
deprecateExtraOptions = true;
|
||||||
|
optionsRenamedToSettings = [
|
||||||
|
"configPath"
|
||||||
|
"binPath"
|
||||||
|
[
|
||||||
|
"api"
|
||||||
|
"host"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"api"
|
||||||
|
"port"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"tools"
|
||||||
|
"uname"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"tools"
|
||||||
|
"uuidgen"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"tools"
|
||||||
|
"curl"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"tools"
|
||||||
|
"gzip"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"tools"
|
||||||
|
"languageServer"
|
||||||
|
]
|
||||||
|
"wrapper"
|
||||||
|
];
|
||||||
|
|
||||||
|
# Register nvim-cmp association
|
||||||
|
imports = [
|
||||||
|
{ cmpSourcePlugins.codeium = "codeium-nvim"; }
|
||||||
|
];
|
||||||
|
|
||||||
|
settingsOptions = {
|
||||||
|
config_path = defaultNullOpts.mkStr {
|
||||||
__raw = "vim.fn.stdpath('cache') .. '/codeium/config.json'";
|
__raw = "vim.fn.stdpath('cache') .. '/codeium/config.json'";
|
||||||
} "The path to the config file, used to store the API key.";
|
} "The path to the config file, used to store the API key.";
|
||||||
|
|
||||||
binPath = helpers.defaultNullOpts.mkStr {
|
bin_path = defaultNullOpts.mkStr {
|
||||||
__raw = "vim.fn.stdpath('cache') .. '/codeium/bin'";
|
__raw = "vim.fn.stdpath('cache') .. '/codeium/bin'";
|
||||||
} "The path to the directory where the Codeium server will be downloaded to.";
|
} "The path to the directory where the Codeium server will be downloaded to.";
|
||||||
|
|
||||||
api = {
|
api = {
|
||||||
host = helpers.defaultNullOpts.mkStr "server.codeium.com" ''
|
host = defaultNullOpts.mkStr "server.codeium.com" ''
|
||||||
The hostname of the API server to use.
|
The hostname of the API server to use.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
port = helpers.defaultNullOpts.mkPositiveInt 443 ''
|
port = defaultNullOpts.mkNullableWithRaw' {
|
||||||
The port of the API server to use.
|
# TODO: Added 2024-09-05; remove after 24.11
|
||||||
'';
|
type = with lib.types; lib.nixvim.transitionType ints.positive toString (strMatching "[0-9]+");
|
||||||
|
pluginDefault = "443";
|
||||||
|
description = ''
|
||||||
|
The port of the API server to use.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
tools = {
|
tools = {
|
||||||
uname = helpers.mkNullOrOption types.str "The path to the `uname` binary.";
|
uname = defaultNullOpts.mkStr null "The path to the `uname` binary.";
|
||||||
|
|
||||||
uuidgen = helpers.mkNullOrOption types.str "The path to the `uuidgen` binary.";
|
uuidgen = defaultNullOpts.mkStr null "The path to the `uuidgen` binary.";
|
||||||
|
|
||||||
curl = helpers.mkNullOrOption types.str "The path to the `curl` binary.";
|
curl = defaultNullOpts.mkStr null "The path to the `curl` binary.";
|
||||||
|
|
||||||
gzip = helpers.mkNullOrOption types.str "The path to the `gzip` binary.";
|
gzip = defaultNullOpts.mkStr null "The path to the `gzip` binary.";
|
||||||
|
|
||||||
languageServer = helpers.mkNullOrOption types.str ''
|
language_server = defaultNullOpts.mkStr null ''
|
||||||
The path to the language server downloaded from the official source.
|
The path to the language server downloaded from the official source.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
wrapper = helpers.mkNullOrOption types.str ''
|
wrapper = defaultNullOpts.mkStr null ''
|
||||||
The path to a wrapper script/binary that is used to execute any binaries not listed under
|
The path to a wrapper script/binary that is used to execute any binaries not listed under
|
||||||
tools.
|
tools.
|
||||||
This is primarily useful for NixOS, where a FHS wrapper can be used for the downloaded
|
This is primarily useful for NixOS, where a FHS wrapper can be used for the downloaded
|
||||||
codeium server.
|
codeium server.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
detect_proxy = defaultNullOpts.mkBool false "Whether to enable the proxy detection.";
|
||||||
|
|
||||||
|
enable_chat = defaultNullOpts.mkBool false "Whether to enable the chat functionality.";
|
||||||
|
|
||||||
|
enterprise_mode = defaultNullOpts.mkBool false "Whether to enable the enterprise mode.";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
settingsExample = lib.literalExpression ''
|
||||||
extraConfigLua =
|
{
|
||||||
let
|
enable_chat = true;
|
||||||
setupOptions =
|
tools = {
|
||||||
with cfg;
|
curl = lib.getExe pkgs.curl;
|
||||||
{
|
gzip = lib.getExe pkgs.gzip;
|
||||||
config_path = configPath;
|
uname = lib.getExe' pkgs.coreutils "uname";
|
||||||
bin_path = binPath;
|
uuidgen = lib.getExe' pkgs.util-linux "uuidgen";
|
||||||
api = with api; {
|
};
|
||||||
inherit host;
|
}
|
||||||
port = if isInt port then toString port else port;
|
'';
|
||||||
};
|
|
||||||
tools = with tools; {
|
|
||||||
inherit
|
|
||||||
uname
|
|
||||||
uuidgen
|
|
||||||
curl
|
|
||||||
gzip
|
|
||||||
;
|
|
||||||
language_server = languageServer;
|
|
||||||
};
|
|
||||||
inherit wrapper;
|
|
||||||
}
|
|
||||||
// cfg.extraOptions;
|
|
||||||
in
|
|
||||||
''
|
|
||||||
require('codeium').setup(${helpers.toLuaObject setupOptions})
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,10 +53,6 @@ let
|
||||||
pluginName = "cmp-tabnine";
|
pluginName = "cmp-tabnine";
|
||||||
sourceName = "cmp_tabnine";
|
sourceName = "cmp_tabnine";
|
||||||
}
|
}
|
||||||
{
|
|
||||||
pluginName = "codeium-nvim";
|
|
||||||
sourceName = "codeium";
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
pluginName = "cmp-conventionalcommits";
|
pluginName = "cmp-conventionalcommits";
|
||||||
sourceName = "conventionalcommits";
|
sourceName = "conventionalcommits";
|
||||||
|
|
|
@ -15,20 +15,24 @@
|
||||||
plugins.codeium-nvim = {
|
plugins.codeium-nvim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
configPath.__raw = "vim.fn.stdpath('cache') .. '/codeium/config.json'";
|
settings = {
|
||||||
binPath.__raw = "vim.fn.stdpath('cache') .. '/codeium/bin'";
|
manager_path = null;
|
||||||
api = {
|
bin_path.__raw = "vim.fn.stdpath('cache') .. '/codeium/bin'";
|
||||||
host = "server.codeium.com";
|
config_path.__raw = "vim.fn.stdpath('cache') .. '/codeium/config.json'";
|
||||||
port = 443;
|
language_server_download_url = "https://github.com";
|
||||||
|
api = {
|
||||||
|
host = "server.codeium.com";
|
||||||
|
port = "443";
|
||||||
|
};
|
||||||
|
enterprise_mode = null;
|
||||||
|
detect_proxy = null;
|
||||||
|
tools = { };
|
||||||
|
wrapper = null;
|
||||||
|
enable_chat = false;
|
||||||
|
enable_local_search = false;
|
||||||
|
enable_index_service = false;
|
||||||
|
search_max_workspace_file_count = 5000;
|
||||||
};
|
};
|
||||||
tools = {
|
|
||||||
uname = null;
|
|
||||||
uuidgen = null;
|
|
||||||
curl = null;
|
|
||||||
gzip = null;
|
|
||||||
languageServer = null;
|
|
||||||
};
|
|
||||||
wrapper = null;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue