From 48d7517fc95d494acbc821520b97447a57d1a6b1 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Thu, 19 Dec 2024 21:31:14 -0600 Subject: [PATCH] vimPlugins.sg-nvim: move out of vim generated --- .../editors/vim/plugins/generated.nix | 12 ---- .../editors/vim/plugins/overrides.nix | 43 +----------- .../editors/vim/plugins/sg-nvim/default.nix | 69 +++++++++++++++++++ .../editors/vim/plugins/vim-plugin-names | 1 - 4 files changed, 70 insertions(+), 55 deletions(-) create mode 100644 pkgs/applications/editors/vim/plugins/sg-nvim/default.nix diff --git a/pkgs/applications/editors/vim/plugins/generated.nix b/pkgs/applications/editors/vim/plugins/generated.nix index a6b55c4b59e2..249dcf560a85 100644 --- a/pkgs/applications/editors/vim/plugins/generated.nix +++ b/pkgs/applications/editors/vim/plugins/generated.nix @@ -11254,18 +11254,6 @@ final: prev: meta.homepage = "https://github.com/junegunn/seoul256.vim/"; }; - sg-nvim = buildVimPlugin { - pname = "sg.nvim"; - version = "2024-12-15"; - src = fetchFromGitHub { - owner = "sourcegraph"; - repo = "sg.nvim"; - rev = "7c423ebeb028b3534eb20fe54972825384dbe7d6"; - sha256 = "1d9ag1q9yxiai5hfm0x4am710gqzx3liw4qg10glskjczmgiic00"; - }; - meta.homepage = "https://github.com/sourcegraph/sg.nvim/"; - }; - shabadou-vim = buildVimPlugin { pname = "shabadou.vim"; version = "2016-07-19"; diff --git a/pkgs/applications/editors/vim/plugins/overrides.nix b/pkgs/applications/editors/vim/plugins/overrides.nix index 6d9027d230d9..db4f196701c0 100644 --- a/pkgs/applications/editors/vim/plugins/overrides.nix +++ b/pkgs/applications/editors/vim/plugins/overrides.nix @@ -89,7 +89,6 @@ callPackage, # Preview-nvim dependencies md-tui, - # sg.nvim dependencies darwin, # sved dependencies glib, @@ -104,8 +103,6 @@ gnused, makeWrapper, procps, - # sg-nvim dependencies - openssl, pkg-config, # vim-agda dependencies agda, @@ -2648,45 +2645,7 @@ in dependencies = [ self.nui-nvim ]; }; - sg-nvim = super.sg-nvim.overrideAttrs ( - old: - let - sg-nvim-rust = rustPlatform.buildRustPackage { - pname = "sg-nvim-rust"; - inherit (old) version src; - - cargoHash = "sha256-/eY4LD488QZHkKvyc3m9vD96gHhZ1961bp9L56xYq9o="; - - nativeBuildInputs = [ pkg-config ]; - - buildInputs = - [ openssl ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - darwin.apple_sdk.frameworks.Security - darwin.apple_sdk.frameworks.SystemConfiguration - ]; - - prePatch = '' - rm .cargo/config.toml - ''; - - env.OPENSSL_NO_VENDOR = true; - - cargoBuildFlags = [ "--workspace" ]; - - # tests are broken - doCheck = false; - }; - in - { - dependencies = [ self.plenary-nvim ]; - postInstall = '' - mkdir -p $out/target/debug - ln -s ${sg-nvim-rust}/{bin,lib}/* $out/target/debug - ''; - nvimRequireCheck = "sg"; - } - ); + sg-nvim = callPackage ./sg-nvim { }; skim = buildVimPlugin { pname = "skim"; diff --git a/pkgs/applications/editors/vim/plugins/sg-nvim/default.nix b/pkgs/applications/editors/vim/plugins/sg-nvim/default.nix new file mode 100644 index 000000000000..3ebc0f3c0204 --- /dev/null +++ b/pkgs/applications/editors/vim/plugins/sg-nvim/default.nix @@ -0,0 +1,69 @@ +{ + lib, + fetchFromGitHub, + nix-update-script, + openssl, + pkg-config, + rustPlatform, + vimPlugins, + vimUtils, +}: +let + version = "1.1.0-unstable-2024-12-15"; + src = fetchFromGitHub { + owner = "sourcegraph"; + repo = "sg.nvim"; + rev = "7c423ebeb028b3534eb20fe54972825384dbe7d6"; + hash = "sha256-ALAYX/1MTk0fCA8THunoHz8QTlWkg+pgiSp2n3B4KrU="; + }; + + sg-nvim-rust = rustPlatform.buildRustPackage { + pname = "sg-nvim-rust"; + inherit version src; + + cargoHash = "sha256-t0+0Zw8NjCD1VB1hTrSjOa1130IVanoTALdFoTloFe4="; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ openssl ]; + + prePatch = '' + rm .cargo/config.toml + ''; + + env.OPENSSL_NO_VENDOR = true; + + cargoBuildFlags = [ "--workspace" ]; + + # tests are broken + doCheck = false; + }; +in +vimUtils.buildVimPlugin { + pname = "sg.nvim"; + inherit version src; + + dependencies = [ vimPlugins.plenary-nvim ]; + + postInstall = '' + mkdir -p $out/target/debug + ln -s ${sg-nvim-rust}/{bin,lib}/* $out/target/debug + ''; + + passthru = { + updateScript = nix-update-script { + extraArgs = [ "--version=branch" ]; + attrPath = "vimPlugins.sg-nvim.sg-nvim-rust"; + }; + + # needed for the update script + inherit sg-nvim-rust; + }; + nvimRequireCheck = "sg"; + + meta = { + description = "Neovim plugin designed to emulate the behaviour of the Cursor AI IDE"; + homepage = "https://github.com/sourcegraph/sg.nvim/"; + license = lib.licenses.asl20; + }; +} diff --git a/pkgs/applications/editors/vim/plugins/vim-plugin-names b/pkgs/applications/editors/vim/plugins/vim-plugin-names index bbb908876dad..edc72a00fd89 100644 --- a/pkgs/applications/editors/vim/plugins/vim-plugin-names +++ b/pkgs/applications/editors/vim/plugins/vim-plugin-names @@ -934,7 +934,6 @@ https://github.com/megaannum/self/,, https://github.com/jaxbot/semantic-highlight.vim/,, https://github.com/numirias/semshi/,, https://github.com/junegunn/seoul256.vim/,, -https://github.com/sourcegraph/sg.nvim/,HEAD, https://github.com/osyo-manga/shabadou.vim/,, https://github.com/AndrewRadev/sideways.vim/,, https://github.com/skim-rs/skim.vim/,,