From af399dfcccdf3a9857f090021141936f723b6c17 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Mon, 23 Dec 2024 02:48:28 +0100 Subject: [PATCH] flake: add plugin blink.cmp --- flake.lock | 17 +++++++++++++++++ flake.nix | 5 +++++ modules/default.nix | 31 +++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/flake.lock b/flake.lock index 97ff6754..4269c3ac 100644 --- a/flake.lock +++ b/flake.lock @@ -188,6 +188,22 @@ "type": "github" } }, + "plugin-blink-cmp": { + "flake": false, + "locked": { + "lastModified": 1734880418, + "narHash": "sha256-jR9fvo+I51DKYQb+N3nFvQ50N+lvYzfFaQtrn7cxDu4=", + "owner": "saghen", + "repo": "blink.cmp", + "rev": "f93af0f486ada13e8c34f42c911788b9232b811f", + "type": "github" + }, + "original": { + "owner": "saghen", + "repo": "blink.cmp", + "type": "github" + } + }, "plugin-bufdelete-nvim": { "flake": false, "locked": { @@ -2076,6 +2092,7 @@ "nmd": "nmd", "plugin-alpha-nvim": "plugin-alpha-nvim", "plugin-base16": "plugin-base16", + "plugin-blink-cmp": "plugin-blink-cmp", "plugin-bufdelete-nvim": "plugin-bufdelete-nvim", "plugin-catppuccin": "plugin-catppuccin", "plugin-ccc": "plugin-ccc", diff --git a/flake.nix b/flake.nix index 161ba43f..f04e72cc 100644 --- a/flake.nix +++ b/flake.nix @@ -288,6 +288,11 @@ flake = false; }; + plugin-blink-cmp = { + url = "github:saghen/blink.cmp"; + flake = false; + }; + plugin-nvim-cmp = { url = "github:hrsh7th/nvim-cmp"; flake = false; diff --git a/modules/default.nix b/modules/default.nix index a2f8730d..b268f94f 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -72,6 +72,37 @@ pname = "flutter-tools"; patches = [../patches/flutter-tools.patch]; }; + blink-cmp = let + version = inputs.plugin-blink-cmp.shortRev or inputs.plugin-blink-cmp.shortDirtyRev or "dirty"; + src = inputs.plugin-blink-cmp; + blink-fuzzy-lib = pkgs.rustPlatform.buildRustPackage { + pname = "blink-fuzzy-lib"; + inherit version src; + + env = { + # TODO: remove this if plugin stops using nightly rust + RUSTC_BOOTSTRAP = true; + }; + cargoLock = { + lockFile = "${src}/Cargo.lock"; + outputHashes = { + "frizbee-0.1.0" = "sha256-pt6sMsRyjXrbrTK7t/YvWeen/n3nU8UUaiNYTY1LczE="; + }; + }; + }; + libExt = + if pkgs.hostPlatform.isDarwin + then "dylib" + else "so"; + in + buildPlug { + pname = "blink-cmp"; + inherit version src; + preInstall = '' + mkdir -p target/release + ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy.${libExt} target/release/libblink_cmp_fuzzy.${libExt} + ''; + }; }; buildConfigPlugins = plugins: