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,
stdenv,
fetchFromGitHub,
nix-update-script,
rustPlatform,
versionCheckHook,
nix-update-script,
vimUtils,
}:
let
version = "1.0.0";
version = "2.2.3";
src = fetchFromGitHub {
owner = "vyfor";
repo = "cord.nvim";
tag = "v${version}";
hash = "sha256-rA3R9SO3QRLGBVHlT5NZLtQw+EmkkmSDO/K6DdNtfBI=";
hash = "sha256-MhUjQxwATAGxIC8ACNDFDm249GzX4Npq3S+sHoUMuos=";
};
extension = if stdenv.hostPlatform.isDarwin then "dylib" else "so";
cord-nvim-rust = rustPlatform.buildRustPackage {
pname = "cord.nvim-rust";
inherit version src;
cord-server = rustPlatform.buildRustPackage {
pname = "cord";
version = "2.2.3";
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;
cargoHash = "sha256-UJdSQNaYaZxvmfuHwePzGhQ3Pv+Cm7YaRK1L0CJhtEc=";
cargoHash = "sha256-hKt9d2u/tlD7bgo49O8oHDLljRvad9dEpGdFt+LH6Ec=";
installPhase =
let
cargoTarget = stdenv.hostPlatform.rust.cargoShortTarget;
in
''
install -D target/${cargoTarget}/release/libcord.${extension} $out/lib/cord.${extension}
'';
# cord depends on nightly features
RUSTC_BOOTSTRAP = 1;
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = "--version";
doInstallCheck = false;
meta.mainProgram = "cord";
};
in
vimUtils.buildVimPlugin {
pname = "cord.nvim";
inherit version src;
nativeBuildInputs = [
cord-nvim-rust
];
buildPhase = ''
runHook preBuild
install -D ${cord-nvim-rust}/lib/cord.${extension} cord.${extension}
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -D cord $out/lua/cord.${extension}
runHook postInstall
# Patch the logic used to find the path to the cord server
# 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 = ''
substituteInPlace lua/cord/server/fs/init.lua \
--replace-fail \
"or M.get_data_path()" \
"'${cord-server}'"
'';
passthru = {
@ -61,11 +60,13 @@ vimUtils.buildVimPlugin {
};
# needed for the update script
inherit cord-nvim-rust;
inherit cord-server;
};
meta = {
homepage = "https://github.com/vyfor/cord.nvim";
license = lib.licenses.asl20;
changelog = "https://github.com/vyfor/cord.nvim/releases/tag/v${version}";
maintainers = with lib.maintainers; [ GaetanLepage ];
};
}