diff --git a/modules/assistant/copilot/config.nix b/modules/assistant/copilot/config.nix new file mode 100644 index 0000000..62d0251 --- /dev/null +++ b/modules/assistant/copilot/config.nix @@ -0,0 +1,24 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.assistant.copilot; +in { + config = mkIf cfg.enable { + vim.startPlugins = [ + "copilot-lua" + pkgs.nodejs-slim-16_x + ]; + + vim.luaConfigRC.copilot = nvim.dag.entryAnywhere '' + require("copilot").setup({ + -- available options: https://github.com/zbirenbaum/copilot.lua + copilot_node_command = "${cfg.copilot_node_command}", + }) + ''; + }; +} diff --git a/modules/assistant/copilot/copilot.nix b/modules/assistant/copilot/copilot.nix new file mode 100644 index 0000000..5dc1245 --- /dev/null +++ b/modules/assistant/copilot/copilot.nix @@ -0,0 +1,20 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.assistant.copilot; +in { + options.vim.assistant.copilot = { + enable = mkEnableOption "Enable GitHub Copilot"; + + copilot_node_command = mkOption { + type = types.str; + default = "${lib.getExe pkgs.nodejs-slim-16_x}"; + description = "Path to nodejs"; + }; + }; +} diff --git a/modules/assistant/copilot/default.nix b/modules/assistant/copilot/default.nix new file mode 100644 index 0000000..fb291bd --- /dev/null +++ b/modules/assistant/copilot/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./copilot.nix + ./config.nix + ]; +}