vimPlugins.cord-nvim: 1.0.0 -> 2.2.3 (#394629)

This commit is contained in:
Gaétan Lepage 2025-03-30 18:36:03 +02:00 committed by GitHub
commit 625d3cc6cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,58 +1,57 @@
{ {
lib, lib,
stdenv,
fetchFromGitHub, fetchFromGitHub,
nix-update-script,
rustPlatform, rustPlatform,
versionCheckHook,
nix-update-script,
vimUtils, vimUtils,
}: }:
let let
version = "1.0.0"; version = "2.2.3";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "vyfor"; owner = "vyfor";
repo = "cord.nvim"; repo = "cord.nvim";
tag = "v${version}"; tag = "v${version}";
hash = "sha256-rA3R9SO3QRLGBVHlT5NZLtQw+EmkkmSDO/K6DdNtfBI="; hash = "sha256-MhUjQxwATAGxIC8ACNDFDm249GzX4Npq3S+sHoUMuos=";
}; };
extension = if stdenv.hostPlatform.isDarwin then "dylib" else "so"; cord-server = rustPlatform.buildRustPackage {
cord-nvim-rust = rustPlatform.buildRustPackage { pname = "cord";
pname = "cord.nvim-rust"; version = "2.2.3";
inherit version src; inherit src;
# The version in .github/server-version.txt differs from the one in Cargo.toml
postPatch = ''
substituteInPlace .github/server-version.txt \
--replace-fail "2.0.0-beta.30" "${version}"
'';
useFetchCargoVendor = true; useFetchCargoVendor = true;
cargoHash = "sha256-UJdSQNaYaZxvmfuHwePzGhQ3Pv+Cm7YaRK1L0CJhtEc="; cargoHash = "sha256-hKt9d2u/tlD7bgo49O8oHDLljRvad9dEpGdFt+LH6Ec=";
installPhase = # cord depends on nightly features
let RUSTC_BOOTSTRAP = 1;
cargoTarget = stdenv.hostPlatform.rust.cargoShortTarget;
in nativeInstallCheckInputs = [
'' versionCheckHook
install -D target/${cargoTarget}/release/libcord.${extension} $out/lib/cord.${extension} ];
''; versionCheckProgramArg = "--version";
doInstallCheck = false;
meta.mainProgram = "cord";
}; };
in in
vimUtils.buildVimPlugin { vimUtils.buildVimPlugin {
pname = "cord.nvim"; pname = "cord.nvim";
inherit version src; inherit version src;
nativeBuildInputs = [ # Patch the logic used to find the path to the cord server
cord-nvim-rust # This still lets the user set config.advanced.server.executable_path
]; # https://github.com/vyfor/cord.nvim/blob/v2.2.3/lua/cord/server/fs/init.lua#L10-L15
postPatch = ''
buildPhase = '' substituteInPlace lua/cord/server/fs/init.lua \
runHook preBuild --replace-fail \
"or M.get_data_path()" \
install -D ${cord-nvim-rust}/lib/cord.${extension} cord.${extension} "'${cord-server}'"
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -D cord $out/lua/cord.${extension}
runHook postInstall
''; '';
passthru = { passthru = {
@ -61,11 +60,13 @@ vimUtils.buildVimPlugin {
}; };
# needed for the update script # needed for the update script
inherit cord-nvim-rust; inherit cord-server;
}; };
meta = { meta = {
homepage = "https://github.com/vyfor/cord.nvim"; homepage = "https://github.com/vyfor/cord.nvim";
license = lib.licenses.asl20; license = lib.licenses.asl20;
changelog = "https://github.com/vyfor/cord.nvim/releases/tag/v${version}";
maintainers = with lib.maintainers; [ GaetanLepage ];
}; };
} }