Skip to content

Commit

Permalink
vimPlugins.avante-nvim: move out to separate directory (NixOS#364001)
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman authored Dec 10, 2024
2 parents b93b330 + 2440ed4 commit b32a094
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 73 deletions.
87 changes: 87 additions & 0 deletions pkgs/applications/editors/vim/plugins/avante-nvim/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
lib,
fetchFromGitHub,
nix-update-script,
openssl,
pkg-config,
rustPlatform,
stdenv,
vimPlugins,
vimUtils,
}:
let
version = "0.0.12";
src = fetchFromGitHub {
owner = "yetone";
repo = "avante.nvim";
tag = "v${version}";
hash = "sha256-yFHX9WCdTBtFZ2Yhy542Rg9nyIu6IWyRjKkS+ojZsdM=";
};
avante-nvim-lib = rustPlatform.buildRustPackage {
pname = "avante-nvim-lib";
inherit version src;

cargoHash = "sha256-n0+UT9wYnmPDOX2LKWztURqYLy2oa8sUeQLycR3/Zr0=";

nativeBuildInputs = [
pkg-config
];

buildInputs = [
openssl
];

buildFeatures = [ "luajit" ];

checkFlags = [
# Disabled because they access the network.
"--skip=test_hf"
"--skip=test_public_url"
"--skip=test_roundtrip"
];
};
in
vimUtils.buildVimPlugin {
pname = "avante-nvim";
inherit version src;

dependencies = with vimPlugins; [
dressing-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}
'';

passthru = {
updateScript = nix-update-script {
attrPath = "vimPlugins.avante-nvim.avante-nvim-lib";
};

# needed for the update script
inherit avante-nvim-lib;
};

doInstallCheck = true;
nvimRequireCheck = "avante";

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
];
};
}
12 changes: 0 additions & 12 deletions pkgs/applications/editors/vim/plugins/generated.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1025,18 +1025,6 @@ final: prev:
meta.homepage = "https://github.com/nullishamy/autosave.nvim/";
};

avante-nvim = buildVimPlugin {
pname = "avante.nvim";
version = "2024-12-05";
src = fetchFromGitHub {
owner = "yetone";
repo = "avante.nvim";
rev = "4464b7f4ae26254cd506a354284a02129941e244";
sha256 = "0h1l3d332hh3gbdwydmm5wpswfzcl7w9j0bx6g6xnazya5cpzc3s";
};
meta.homepage = "https://github.com/yetone/avante.nvim/";
};

aw-watcher-vim = buildVimPlugin {
pname = "aw-watcher-vim";
version = "2023-10-09";
Expand Down
61 changes: 1 addition & 60 deletions pkgs/applications/editors/vim/plugins/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -197,66 +197,7 @@ in
];
};

avante-nvim = super.avante-nvim.overrideAttrs (
oldAttrs:
let
avante-nvim-lib = rustPlatform.buildRustPackage {
pname = "avante-nvim-lib";
inherit (oldAttrs) version src;

cargoHash = "sha256-kbgJlvYtL69i6br5jQ9QiCXEQuOWiHRDFWAofyKJb2s=";

nativeBuildInputs = [
pkg-config
];

buildInputs = [
openssl
];

buildFeatures = [ "luajit" ];

checkFlags = [
# Disabled because they access the network.
"--skip=test_hf"
"--skip=test_public_url"
"--skip=test_roundtrip"
];
};
in
{
dependencies = with self; [
dressing-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}
'';

doInstallCheck = true;
nvimRequireCheck = "avante";

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
];
};
}
);
avante-nvim = callPackage ./avante-nvim { };

aw-watcher-vim = super.aw-watcher-vim.overrideAttrs {
patches = [
Expand Down
1 change: 0 additions & 1 deletion pkgs/applications/editors/vim/plugins/vim-plugin-names
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ https://github.com/m4xshen/autoclose.nvim/,HEAD,
https://github.com/gaoDean/autolist.nvim/,,
https://github.com/vim-scripts/autoload_cscope.vim/,,
https://github.com/nullishamy/autosave.nvim/,HEAD,
https://github.com/yetone/avante.nvim/,HEAD,
https://github.com/rafi/awesome-vim-colorschemes/,,
https://github.com/AhmedAbdulrahman/aylin.vim/,,
https://github.com/ayu-theme/ayu-vim/,,
Expand Down

0 comments on commit b32a094

Please sign in to comment.