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

authored by Gaétan Lepage and committed by GitHub 625d3cc6 3e0daa11

+36 -35
+36 -35
pkgs/applications/editors/vim/plugins/non-generated/cord-nvim/default.nix
··· 1 1 { 2 2 lib, 3 - stdenv, 4 3 fetchFromGitHub, 4 + rustPlatform, 5 + versionCheckHook, 5 6 nix-update-script, 6 - rustPlatform, 7 7 vimUtils, 8 8 }: 9 9 let 10 - version = "1.0.0"; 10 + version = "2.2.3"; 11 11 src = fetchFromGitHub { 12 12 owner = "vyfor"; 13 13 repo = "cord.nvim"; 14 14 tag = "v${version}"; 15 - hash = "sha256-rA3R9SO3QRLGBVHlT5NZLtQw+EmkkmSDO/K6DdNtfBI="; 15 + hash = "sha256-MhUjQxwATAGxIC8ACNDFDm249GzX4Npq3S+sHoUMuos="; 16 16 }; 17 - extension = if stdenv.hostPlatform.isDarwin then "dylib" else "so"; 18 - cord-nvim-rust = rustPlatform.buildRustPackage { 19 - pname = "cord.nvim-rust"; 20 - inherit version src; 17 + cord-server = rustPlatform.buildRustPackage { 18 + pname = "cord"; 19 + version = "2.2.3"; 20 + inherit src; 21 + 22 + # The version in .github/server-version.txt differs from the one in Cargo.toml 23 + postPatch = '' 24 + substituteInPlace .github/server-version.txt \ 25 + --replace-fail "2.0.0-beta.30" "${version}" 26 + ''; 21 27 22 28 useFetchCargoVendor = true; 23 - cargoHash = "sha256-UJdSQNaYaZxvmfuHwePzGhQ3Pv+Cm7YaRK1L0CJhtEc="; 29 + cargoHash = "sha256-hKt9d2u/tlD7bgo49O8oHDLljRvad9dEpGdFt+LH6Ec="; 24 30 25 - installPhase = 26 - let 27 - cargoTarget = stdenv.hostPlatform.rust.cargoShortTarget; 28 - in 29 - '' 30 - install -D target/${cargoTarget}/release/libcord.${extension} $out/lib/cord.${extension} 31 - ''; 31 + # cord depends on nightly features 32 + RUSTC_BOOTSTRAP = 1; 33 + 34 + nativeInstallCheckInputs = [ 35 + versionCheckHook 36 + ]; 37 + versionCheckProgramArg = "--version"; 38 + doInstallCheck = false; 39 + 40 + meta.mainProgram = "cord"; 32 41 }; 33 42 in 34 43 vimUtils.buildVimPlugin { 35 44 pname = "cord.nvim"; 36 45 inherit version src; 37 46 38 - nativeBuildInputs = [ 39 - cord-nvim-rust 40 - ]; 41 - 42 - buildPhase = '' 43 - runHook preBuild 44 - 45 - install -D ${cord-nvim-rust}/lib/cord.${extension} cord.${extension} 46 - 47 - runHook postBuild 48 - ''; 49 - 50 - installPhase = '' 51 - runHook preInstall 52 - 53 - install -D cord $out/lua/cord.${extension} 54 - 55 - runHook postInstall 47 + # Patch the logic used to find the path to the cord server 48 + # This still lets the user set config.advanced.server.executable_path 49 + # https://github.com/vyfor/cord.nvim/blob/v2.2.3/lua/cord/server/fs/init.lua#L10-L15 50 + postPatch = '' 51 + substituteInPlace lua/cord/server/fs/init.lua \ 52 + --replace-fail \ 53 + "or M.get_data_path()" \ 54 + "'${cord-server}'" 56 55 ''; 57 56 58 57 passthru = { ··· 61 60 }; 62 61 63 62 # needed for the update script 64 - inherit cord-nvim-rust; 63 + inherit cord-server; 65 64 }; 66 65 67 66 meta = { 68 67 homepage = "https://github.com/vyfor/cord.nvim"; 69 68 license = lib.licenses.asl20; 69 + changelog = "https://github.com/vyfor/cord.nvim/releases/tag/v${version}"; 70 + maintainers = with lib.maintainers; [ GaetanLepage ]; 70 71 }; 71 72 }