{ lib, fetchFromGitHub, nix-update-script, openssl, pkg-config, rustPlatform, stdenv, vimPlugins, vimUtils, makeWrapper, pkgs, }: let version = "0.0.27-unstable-2025-10-06"; src = fetchFromGitHub { owner = "yetone"; repo = "avante.nvim"; rev = "a7052aca0bdfb93e524f0536ac80e6c542962f47"; hash = "sha256-crtzBzRcpuqQdqymUJMAxky1Lfk+6YY0YifThHXz7Rw="; }; avante-nvim-lib = rustPlatform.buildRustPackage { pname = "avante-nvim-lib"; inherit version src; cargoHash = "sha256-pTWCT2s820mjnfTscFnoSKC37RE7DAPKxP71QuM+JXQ="; nativeBuildInputs = [ pkg-config makeWrapper pkgs.perl ]; buildInputs = [ openssl ]; buildFeatures = [ "luajit" ]; checkFlags = [ # Disabled because they access the network. "--skip=test_hf" "--skip=test_public_url" "--skip=test_roundtrip" "--skip=test_fetch_md" ]; }; in vimUtils.buildVimPlugin { pname = "avante.nvim"; inherit version src; dependencies = with vimPlugins; [ dressing-nvim img-clip-nvim nui-nvim nvim-treesitter plenary-nvim ]; postInstall = let ext = stdenv.hostPlatform.extensions.sharedLibrary; in '' mkdir -p $out/build ln -s ${avante-nvim-lib}/lib/libavante_repo_map${ext} $out/build/avante_repo_map${ext} ln -s ${avante-nvim-lib}/lib/libavante_templates${ext} $out/build/avante_templates${ext} ln -s ${avante-nvim-lib}/lib/libavante_tokenizers${ext} $out/build/avante_tokenizers${ext} ln -s ${avante-nvim-lib}/lib/libavante_html2md${ext} $out/build/avante_html2md${ext} ''; passthru = { updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; attrPath = "vimPlugins.avante-nvim.avante-nvim-lib"; }; # needed for the update script inherit avante-nvim-lib; }; nvimSkipModules = [ # Requires setup with corresponding provider "avante.providers.azure" "avante.providers.copilot" "avante.providers.gemini" "avante.providers.ollama" "avante.providers.vertex" "avante.providers.vertex_claude" ]; meta = { description = "Neovim plugin designed to emulate the behaviour of the Cursor AI IDE"; homepage = "https://github.com/yetone/avante.nvim"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ ttrei aarnphm jackcres ]; }; }