Skip to content

plugins/copilot-lua: add curl and nodejs dependency #3339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 17 additions & 25 deletions plugins/by-name/copilot-lua/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ lib.nixvim.plugins.mkNeovimPlugin {

maintainers = [ lib.maintainers.HeitorAugustoLN ];

dependencies = [
"curl"
"nodejs"
];

settingsOptions =
let
mkKeymapOption = defaultNullOpts.mkNullableWithRaw (with types; either (enum [ false ]) str);
Expand Down Expand Up @@ -105,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;
Expand Down Expand Up @@ -164,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" {
Expand Down