1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 stdenv,
6 vimUtils,
7 nix-update-script,
8 gitMinimal,
9}:
10let
11 version = "1.6.0";
12 src = fetchFromGitHub {
13 owner = "Saghen";
14 repo = "blink.cmp";
15 tag = "v${version}";
16 hash = "sha256-IHRYgKcYP+JDGu8Vtawgzlhq25vpROFqb8KmpfVMwCk=";
17 };
18 blink-fuzzy-lib = rustPlatform.buildRustPackage {
19 inherit version src;
20 pname = "blink-fuzzy-lib";
21
22 cargoHash = "sha256-QsVCugYWRri4qu64wHnbJQZBhy4tQrr+gCYbXtRBlqE=";
23
24 nativeBuildInputs = [ gitMinimal ];
25
26 env = {
27 # TODO: remove this if plugin stops using nightly rust
28 RUSTC_BOOTSTRAP = true;
29 };
30 };
31in
32vimUtils.buildVimPlugin {
33 pname = "blink.cmp";
34 inherit version src;
35 preInstall =
36 let
37 ext = stdenv.hostPlatform.extensions.sharedLibrary;
38 in
39 ''
40 mkdir -p target/release
41 ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy${ext} target/release/libblink_cmp_fuzzy${ext}
42 '';
43
44 passthru = {
45 updateScript = nix-update-script {
46 attrPath = "vimPlugins.blink-cmp.blink-fuzzy-lib";
47 };
48
49 # needed for the update script
50 inherit blink-fuzzy-lib;
51 };
52
53 meta = {
54 description = "Performant, batteries-included completion plugin for Neovim";
55 homepage = "https://github.com/saghen/blink.cmp";
56 changelog = "https://github.com/Saghen/blink.cmp/blob/v${version}/CHANGELOG.md";
57 maintainers = with lib.maintainers; [
58 balssh
59 redxtech
60 llakala
61 ];
62 };
63
64 nvimSkipModules = [
65 # Module for reproducing issues
66 "repro"
67 ];
68}