fix: set avante-nvim to build from source

This commit is contained in:
Farouk Brown 2025-04-26 19:45:58 +01:00
commit 64bee7e729
5 changed files with 100 additions and 12 deletions

View file

@ -28,6 +28,17 @@
sha256 = pin.hash; sha256 = pin.hash;
}; };
}; };
avante-nvim = let
pin = self.pins.avante-nvim;
in
final.callPackage ./legacyPackages/avante-nvim.nix {
version = pin.branch;
src = prev.fetchFromGitHub {
inherit (pin.repository) owner repo;
rev = pin.revision;
sha256 = pin.hash;
};
};
}) })
]; ];
}; };

View file

@ -0,0 +1,81 @@
{
nix-update-script,
openssl,
pkg-config,
rustPlatform,
stdenv,
vimPlugins,
vimUtils,
makeWrapper,
pkgs,
version,
src,
}: let
inherit version src;
avante-nvim-lib = rustPlatform.buildRustPackage {
pname = "avante-nvim-lib";
inherit version src;
useFetchCargoVendor = true;
cargoHash = "sha256-pmnMoNdaIR0i+4kwW3cf01vDQo39QakTCEG9AXA86ck=";
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 {
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.vertex_claude"
"avante.providers.ollama"
];
}

View file

@ -1,5 +1,4 @@
{ {
pkgs,
config, config,
lib, lib,
... ...
@ -17,8 +16,8 @@ in {
]; ];
lazy.plugins = { lazy.plugins = {
"avante.nvim" = with pkgs.vimPlugins; { avante-nvim = {
package = avante-nvim; package = "avante-nvim";
setupModule = "avante"; setupModule = "avante";
inherit (cfg) setupOpts; inherit (cfg) setupOpts;
event = ["DeferredUIEnter"]; event = ["DeferredUIEnter"];

View file

@ -51,7 +51,7 @@
doCheck = false; doCheck = false;
}; };
inherit (inputs.self.legacyPackages.${pkgs.stdenv.system}) blink-cmp; inherit (inputs.self.legacyPackages.${pkgs.stdenv.system}) blink-cmp avante-nvim;
}; };
buildConfigPlugins = plugins: buildConfigPlugins = plugins:

View file

@ -27,20 +27,17 @@
"hash": "0c1jkhxamfn2md7m1r5b2wpxa26y90b98yzjwf68m3fymalvkn5h" "hash": "0c1jkhxamfn2md7m1r5b2wpxa26y90b98yzjwf68m3fymalvkn5h"
}, },
"avante-nvim": { "avante-nvim": {
"type": "GitRelease", "type": "Git",
"repository": { "repository": {
"type": "GitHub", "type": "GitHub",
"owner": "yetone", "owner": "yetone",
"repo": "avante.nvim" "repo": "avante.nvim"
}, },
"pre_releases": false, "branch": "main",
"version_upper_bound": null,
"release_prefix": null,
"submodules": false, "submodules": false,
"version": "v0.0.23", "revision": "f9aa75459d403d9e963ef2647c9791e0dfc9e5f9",
"revision": "868c13657442b799a5c161940602f99623a08197", "url": "https://github.com/yetone/avante.nvim/archive/f9aa75459d403d9e963ef2647c9791e0dfc9e5f9.tar.gz",
"url": "https://api.github.com/repos/yetone/avante.nvim/tarball/v0.0.23", "hash": "1qgdxapmw24zkx3d4cwv6f459p2a6dw7pvx7sa3650px2n75bb31"
"hash": "11h0fch0whr2mh23940h3k7l6grnp5bqv2nyxywkg1zvj680vpji"
}, },
"base16": { "base16": {
"type": "Git", "type": "Git",