diff --git a/modules/programs/nvim/new_plugins/avante.nix b/modules/programs/nvim/new_plugins/avante.nix new file mode 100644 index 0000000..1bf5c89 --- /dev/null +++ b/modules/programs/nvim/new_plugins/avante.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, inputs, ... }: + +let + inherit (lib) mkEnableOption mkIf readFile; +in +{ + home-manager.users.moritz.programs.nixvim = { + extraPlugins = [ + (pkgs.vimUtils.buildVimPlugin { + pname = "avante.nvim"; + src = inputs.avante-nvim; + version = lib.my.mkVersionInput inputs.avante-nvim; + }) + pkgs.vimPlugins.nui-nvim + ]; + extraConfigLuaPost = '' + require("avante").setup({ + provider = "openai", + auto_suggestions_provider = "openai", + openai = { + api_key_name = "cmd:cat /run/agenix/openai" + } + }) + ''; + plugins.copilot-lua.enable = true; + plugins.copilot-lua.suggestion.enabled = false; + plugins.copilot-lua.panel.enabled = false; + plugins.dressing.enable = true; + performance.combinePlugins.standalonePlugins = [ "copilot.lua" ]; + }; + age.secrets."openai".file = ../../../../secrets/openai.age; + age.secrets."openai".owner = "moritz"; +} diff --git a/modules/programs/nvim/new_plugins/other.nix b/modules/programs/nvim/new_plugins/other.nix index 479cd38..b5d91a1 100644 --- a/modules/programs/nvim/new_plugins/other.nix +++ b/modules/programs/nvim/new_plugins/other.nix @@ -145,27 +145,7 @@ in { plugins.friendly-snippets.enable = true; } { plugins.direnv.enable = true; } { plugins.crates-nvim.enable = true; } - { - extraPlugins = [ - (pkgs.vimUtils.buildVimPlugin { - pname = "avante.nvim"; - src = inputs.avante-nvim; - version = lib.my.mkVersionInput inputs.avante-nvim; - }) - pkgs.vimPlugins.nui-nvim - ]; - extraConfigLuaPost = '' - require("avante").setup({ - provider = "copilot", - auto_suggestions_provider = "copilot", - }) - ''; - plugins.copilot-lua.enable = true; - plugins.copilot-lua.suggestion.enabled = false; - plugins.copilot-lua.panel.enabled = false; - plugins.dressing.enable = true; - performance.combinePlugins.standalonePlugins = [ "copilot.lua" ]; - } + ]; }; } diff --git a/secrets/openai.age b/secrets/openai.age new file mode 100644 index 0000000..32ad562 Binary files /dev/null and b/secrets/openai.age differ diff --git a/secrets/secrets.nix b/secrets/secrets.nix index f067153..e146a68 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -26,4 +26,5 @@ in "root-password.age".publicKeys = personal; "moritz-password.age".publicKeys = personal; "exercism.age".publicKeys = personal; + "openai.age".publicKeys = personal; }