From b996c123e624ce831319b75dd4b78fa7466077a0 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 10 May 2023 12:11:33 +0300 Subject: [PATCH] feat: make Copilot node package configurable --- modules/assistant/copilot/config.nix | 2 +- modules/assistant/copilot/copilot.nix | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/assistant/copilot/config.nix b/modules/assistant/copilot/config.nix index 112a3f7..c920e35 100644 --- a/modules/assistant/copilot/config.nix +++ b/modules/assistant/copilot/config.nix @@ -23,7 +23,7 @@ in { config = mkIf cfg.enable { vim.startPlugins = [ "copilot-lua" - pkgs.nodejs-slim-16_x + cfg.copilotNodePackage ]; vim.luaConfigRC.copilot = nvim.dag.entryAnywhere '' diff --git a/modules/assistant/copilot/copilot.nix b/modules/assistant/copilot/copilot.nix index 5529dcb..23f2619 100644 --- a/modules/assistant/copilot/copilot.nix +++ b/modules/assistant/copilot/copilot.nix @@ -5,7 +5,9 @@ ... }: with lib; -with builtins; { +with builtins; let + cfg = config.vim.assistant.copilot; +in { options.vim.assistant.copilot = { enable = mkEnableOption "Enable GitHub Copilot"; @@ -91,8 +93,14 @@ with builtins; { copilot_node_command = mkOption { type = types.str; - default = "${lib.getExe pkgs.nodejs-slim-16_x}"; + default = "${lib.getExe cfg.copilotNodePackage}"; description = "Path to nodejs"; }; + + copilotNodePackage = mkOption { + type = with types; nullOr package; + default = pkgs.nodejs-slim-16_x; + description = "The package that will be used for Copilot. NodeJS v16 is recommended."; + }; }; }