plugins/copilot-lua: add nodejs dependency and remove nodePackage option

This commit is contained in:
Heitor Augusto 2025-05-17 12:53:11 -03:00
parent 284ce8043b
commit 5474f9a33f
No known key found for this signature in database
GPG key ID: 53C04F8F46A1A344

View file

@ -15,7 +15,10 @@ lib.nixvim.plugins.mkNeovimPlugin {
maintainers = [ lib.maintainers.HeitorAugustoLN ];
dependencies = [ "curl" ];
dependencies = [
"curl"
"nodejs"
];
settingsOptions =
let
@ -107,21 +110,10 @@ lib.nixvim.plugins.mkNeovimPlugin {
'';
};
copilot_node_command =
let
inherit (config.plugins.copilot-lua) nodePackage;
in
lib.nixvim.mkNullOrOption' {
type = types.str;
default = if nodePackage == null then null else lib.getExe nodePackage;
defaultText = lib.literalMD "`lib.getExe nodePackage` if `nodePackage` is not null, otherwise `null`";
pluginDefault = "node";
example = lib.literalExpression "lib.getExe pkgs.nodejs";
description = ''
Define the node command to use for copilot-lua.
Node.js version must be 18.x or newer.
'';
};
copilot_node_command = defaultNullOpts.mkStr "node" ''
Define the node command to use for copilot-lua.
Node.js version must be 20.x or newer.
'';
server_opts_overrides = defaultNullOpts.mkAttrsOf' {
type = types.anything;
@ -166,16 +158,14 @@ lib.nixvim.plugins.mkNeovimPlugin {
};
};
extraOptions = {
nodePackage = lib.mkPackageOption pkgs "nodejs" {
default = [ "nodejs_20" ];
example = [ "nodejs" ];
nullable = true;
extraDescription = ''
If non-null, will provide a default for `settings.copilot_node_command`.
'';
};
};
# TODO: introduced 2025-05-17: remove after 25.11
imports = [
(lib.mkRemovedOptionModule [
"plugins"
"copilot-lua"
"nodePackage"
] "Use `dependencies.nodejs.package` instead to change the Node.js package.")
];
extraConfig = {
assertions = lib.nixvim.mkAssertions "plugins.copilot-lua" {