From bf85431c4826ed9eb84ee56f8dd9e585aade9940 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Thu, 19 Dec 2024 21:53:41 -0600 Subject: [PATCH] vimPlugins.cord-nvim: move to separate folder Already wasn't in generated or plugin list, had to be manually updated. Moving to callPackage in overrides with update script support. --- .../editors/vim/plugins/cord-nvim/default.nix | 74 +++++++++++++++++++ .../editors/vim/plugins/overrides.nix | 49 +----------- 2 files changed, 75 insertions(+), 48 deletions(-) create mode 100644 pkgs/applications/editors/vim/plugins/cord-nvim/default.nix diff --git a/pkgs/applications/editors/vim/plugins/cord-nvim/default.nix b/pkgs/applications/editors/vim/plugins/cord-nvim/default.nix new file mode 100644 index 000000000000..1346697f0c09 --- /dev/null +++ b/pkgs/applications/editors/vim/plugins/cord-nvim/default.nix @@ -0,0 +1,74 @@ +{ + lib, + stdenv, + fetchFromGitHub, + nix-update-script, + rustPlatform, + vimUtils, +}: +let + version = "0-unstable-2024-09-26"; + src = fetchFromGitHub { + owner = "vyfor"; + repo = "cord.nvim"; + rev = "a26b00d58c42174aadf975917b49cec67650545f"; + hash = "sha256-jUxBvWnj0+axuw2SZ2zLzlhZS0tu+Bk8+wHtXENofkw="; + }; + extension = if stdenv.hostPlatform.isDarwin then "dylib" else "so"; + cord-nvim-rust = rustPlatform.buildRustPackage { + pname = "cord.nvim-rust"; + inherit version src; + + cargoHash = "sha256-M5mTdBACTaUVZhPpMOf1KQ3BcQpEoD2isAKRn+iAWjc="; + + installPhase = + let + cargoTarget = stdenv.hostPlatform.rust.cargoShortTarget; + in + '' + install -D target/${cargoTarget}/release/libcord.${extension} $out/lib/cord.${extension} + ''; + }; +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 + ''; + + doInstallCheck = true; + nvimRequireCheck = "cord"; + + passthru = { + updateScript = nix-update-script { + extraArgs = [ "--version=branch" ]; + attrPath = "vimPlugins.cord-nvim.cord-nvim-rust"; + }; + + # needed for the update script + inherit cord-nvim-rust; + }; + + meta = { + homepage = "https://github.com/vyfor/cord.nvim"; + license = lib.licenses.asl20; + }; +} diff --git a/pkgs/applications/editors/vim/plugins/overrides.nix b/pkgs/applications/editors/vim/plugins/overrides.nix index 1530e2f009c3..38bf716cfd09 100644 --- a/pkgs/applications/editors/vim/plugins/overrides.nix +++ b/pkgs/applications/editors/vim/plugins/overrides.nix @@ -843,54 +843,7 @@ in nvimRequireCheck = "coq"; }; - cord-nvim = - let - version = "0-unstable-2024-09-26"; - src = fetchFromGitHub { - owner = "vyfor"; - repo = "cord.nvim"; - rev = "a26b00d58c42174aadf975917b49cec67650545f"; - hash = "sha256-jUxBvWnj0+axuw2SZ2zLzlhZS0tu+Bk8+wHtXENofkw="; - }; - extension = if stdenv.hostPlatform.isDarwin then "dylib" else "so"; - rustPackage = rustPlatform.buildRustPackage { - pname = "cord.nvim-rust"; - inherit version src; - - cargoHash = "sha256-M5mTdBACTaUVZhPpMOf1KQ3BcQpEoD2isAKRn+iAWjc="; - - installPhase = - let - cargoTarget = stdenv.hostPlatform.rust.cargoShortTarget; - in - '' - install -D target/${cargoTarget}/release/libcord.${extension} $out/lib/cord.${extension} - ''; - }; - in - buildVimPlugin { - pname = "cord.nvim"; - inherit version src; - - nativeBuildInputs = [ - rustPackage - ]; - - buildPhase = '' - install -D ${rustPackage}/lib/cord.${extension} cord.${extension} - ''; - - installPhase = '' - install -D cord $out/lua/cord.${extension} - ''; - - doInstallCheck = true; - nvimRequireCheck = "cord"; - - meta = { - homepage = "https://github.com/vyfor/cord.nvim"; - }; - }; + cord-nvim = callPackage ./cord-nvim { }; cornelis = super.cornelis.overrideAttrs { dependencies = [ self.vim-textobj-user ];