diff --git a/pkgs/applications/editors/vim/plugins/codesnap-nvim/default.nix b/pkgs/applications/editors/vim/plugins/codesnap-nvim/default.nix new file mode 100644 index 000000000000..66d106a83f77 --- /dev/null +++ b/pkgs/applications/editors/vim/plugins/codesnap-nvim/default.nix @@ -0,0 +1,71 @@ +{ + lib, + stdenv, + fetchFromGitHub, + nix-update-script, + pkg-config, + rustPlatform, + vimUtils, + libuv, +}: +let + version = "1.6.1"; + src = fetchFromGitHub { + owner = "mistricky"; + repo = "codesnap.nvim"; + tag = "v${version}"; + hash = "sha256-OmSgrTYDtNb2plMyzjVvxGrfXB/lGKDpUQhpRqKfAMA="; + }; + codesnap-lib = rustPlatform.buildRustPackage { + pname = "codesnap-lib"; + inherit version src; + + sourceRoot = "${src.name}/generator"; + + cargoHash = "sha256-6n37n8oHIHrz3S1+40nuD0Ud3l0iNgXig1ZwrgsnYTI="; + + nativeBuildInputs = [ + pkg-config + rustPlatform.bindgenHook + ]; + + buildInputs = [ + libuv.dev + ]; + }; +in +vimUtils.buildVimPlugin { + pname = "codesnap.nvim"; + inherit version src; + + # - Remove the shipped pre-built binaries + # - Copy the resulting binary from the codesnap-lib derivation + # Note: the destination should be generator.so, even on darwin + # https://github.com/mistricky/codesnap.nvim/blob/main/scripts/build_generator.sh + postInstall = + let + extension = if stdenv.hostPlatform.isDarwin then "dylib" else "so"; + in + '' + rm -r $out/lua/*.so + cp ${codesnap-lib}/lib/libgenerator.${extension} $out/lua/generator.so + ''; + + doInstallCheck = true; + nvimRequireCheck = "codesnap"; + + passthru = { + updateScript = nix-update-script { + attrPath = "vimPlugins.codesnap-nvim.codesnap-lib"; + }; + + # needed for the update script + inherit codesnap-lib; + }; + + meta = { + homepage = "https://github.com/mistricky/codesnap.nvim/"; + changelog = "https://github.com/mistricky/codesnap.nvim/releases/tag/${src.tag}"; + license = lib.licenses.mit; + }; +} diff --git a/pkgs/applications/editors/vim/plugins/generated.nix b/pkgs/applications/editors/vim/plugins/generated.nix index 4201ae9c839f..16e200001ba4 100644 --- a/pkgs/applications/editors/vim/plugins/generated.nix +++ b/pkgs/applications/editors/vim/plugins/generated.nix @@ -2465,18 +2465,6 @@ final: prev: meta.homepage = "https://github.com/Exafunction/codeium.vim/"; }; - codesnap-nvim = buildVimPlugin { - pname = "codesnap.nvim"; - version = "2024-09-22"; - src = fetchFromGitHub { - owner = "mistricky"; - repo = "codesnap.nvim"; - rev = "6400480aa6cc366cbd931146c429aaa64680dab9"; - sha256 = "1kdqh5vn837pxygz141n01zw08apcxi39xzdn5a0zhddimqn16z1"; - }; - meta.homepage = "https://github.com/mistricky/codesnap.nvim/"; - }; - codewindow-nvim = buildVimPlugin { pname = "codewindow.nvim"; version = "2024-06-05"; diff --git a/pkgs/applications/editors/vim/plugins/overrides.nix b/pkgs/applications/editors/vim/plugins/overrides.nix index 1530e2f009c3..105a5ffd7c86 100644 --- a/pkgs/applications/editors/vim/plugins/overrides.nix +++ b/pkgs/applications/editors/vim/plugins/overrides.nix @@ -72,9 +72,6 @@ zsh, # codeium-nvim dependencies codeium, - # codesnap-nvim dependencies - clang, - libuv, # command-t dependencies getconf, ruby, @@ -678,62 +675,7 @@ in nvimRequireCheck = "codeium"; }; - codesnap-nvim = - let - version = "1.6.1"; - src = fetchFromGitHub { - owner = "mistricky"; - repo = "codesnap.nvim"; - rev = "refs/tags/v${version}"; - hash = "sha256-OmSgrTYDtNb2plMyzjVvxGrfXB/lGKDpUQhpRqKfAMA="; - }; - codesnap-lib = rustPlatform.buildRustPackage { - pname = "codesnap-lib"; - inherit version src; - - sourceRoot = "${src.name}/generator"; - - cargoHash = "sha256-6n37n8oHIHrz3S1+40nuD0Ud3l0iNgXig1ZwrgsnYTI="; - - nativeBuildInputs = [ - pkg-config - rustPlatform.bindgenHook - ]; - - buildInputs = - [ - libuv.dev - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - darwin.apple_sdk.frameworks.AppKit - ]; - }; - in - buildVimPlugin { - pname = "codesnap.nvim"; - inherit version src; - - # - Remove the shipped pre-built binaries - # - Copy the resulting binary from the codesnap-lib derivation - # Note: the destination should be generator.so, even on darwin - # https://github.com/mistricky/codesnap.nvim/blob/main/scripts/build_generator.sh - postInstall = - let - extension = if stdenv.hostPlatform.isDarwin then "dylib" else "so"; - in - '' - rm -r $out/lua/*.so - cp ${codesnap-lib}/lib/libgenerator.${extension} $out/lua/generator.so - ''; - - doInstallCheck = true; - nvimRequireCheck = "codesnap"; - - meta = { - homepage = "https://github.com/mistricky/codesnap.nvim/"; - changelog = "https://github.com/mistricky/codesnap.nvim/releases/tag/v${version}"; - }; - }; + codesnap-nvim = callPackage ./codesnap-nvim { }; codewindow-nvim = super.codewindow-nvim.overrideAttrs { dependencies = [ self.nvim-treesitter ]; diff --git a/pkgs/applications/editors/vim/plugins/vim-plugin-names b/pkgs/applications/editors/vim/plugins/vim-plugin-names index e87c429fb6d6..2025d918087e 100644 --- a/pkgs/applications/editors/vim/plugins/vim-plugin-names +++ b/pkgs/applications/editors/vim/plugins/vim-plugin-names @@ -203,7 +203,6 @@ https://github.com/manicmaniac/coconut.vim/,HEAD, https://github.com/olimorris/codecompanion.nvim/,HEAD, https://github.com/Exafunction/codeium.nvim/,HEAD, https://github.com/Exafunction/codeium.vim/,HEAD, -https://github.com/mistricky/codesnap.nvim/,HEAD, https://github.com/gorbit99/codewindow.nvim/,HEAD, https://github.com/metakirby5/codi.vim/,, https://github.com/tjdevries/colorbuddy.nvim/,,