From ff0770f3ed6c397336b8001550dd024d06847c79 Mon Sep 17 00:00:00 2001 From: "RingOfStorms (Joshua Bell)" Date: Thu, 14 Nov 2024 15:10:50 -0600 Subject: [PATCH] fix on macos --- flake.nix | 6 +++++- lua/plugins/avante.lua | 25 +++++++++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index 9aa5ab3..4de8e36 100644 --- a/flake.nix +++ b/flake.nix @@ -309,11 +309,15 @@ "LD_LIBRARY_PATH" ":" "${avante-nvim-lib}/lib" - # Add Lua C modules path + # Add Lua C modules path TODO make these conditional so on linux, and dylib for mac it shouldn't be both... "--prefix" "LUA_CPATH" ";" "${avante-nvim-lib}/lib/?.so" + "--prefix" + "LUA_CPATH" + ";" + "${avante-nvim-lib}/lib/?.dylib" # Don't use default directories to not collide with another neovim config # All things at runtime should be deletable since we are using nix to handle downloads and bins # so I've chosen to put everything into the local state directory. diff --git a/lua/plugins/avante.lua b/lua/plugins/avante.lua index f933fed..c19106a 100644 --- a/lua/plugins/avante.lua +++ b/lua/plugins/avante.lua @@ -33,14 +33,23 @@ return { end end, lazy = false, - opts = { - provider = "claude", - behavior = { - -- auto_suggestions = true, -- Experimental stage - auto_set_keymaps = false, - support_paste_from_clipboard = true, - }, - }, + opts = function() + local provider + if os.getenv("ANTHROPIC_API_KEY") then + provider = "claude" + else + provider = "copilot" + end + + return { + provider = provider, + behavior = { + -- auto_suggestions = true, -- Experimental stage + auto_set_keymaps = false, + support_paste_from_clipboard = true, + }, + } + end, config = function(_, opts) require("avante_lib").load() require("avante").setup(opts)