mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-19 07:29:49 +01:00
feat: separate copilot module and configuration
This commit is contained in:
parent
812f1f3b06
commit
3694a84646
3 changed files with 50 additions and 0 deletions
24
modules/assistant/copilot/config.nix
Normal file
24
modules/assistant/copilot/config.nix
Normal file
|
@ -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}",
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
20
modules/assistant/copilot/copilot.nix
Normal file
20
modules/assistant/copilot/copilot.nix
Normal file
|
@ -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";
|
||||
};
|
||||
};
|
||||
}
|
6
modules/assistant/copilot/default.nix
Normal file
6
modules/assistant/copilot/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./copilot.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue