diff --git a/pkgs/applications/editors/vim/plugins/overrides.nix b/pkgs/applications/editors/vim/plugins/overrides.nix index c40f98f4fdef..332d7528ddda 100644 --- a/pkgs/applications/editors/vim/plugins/overrides.nix +++ b/pkgs/applications/editors/vim/plugins/overrides.nix @@ -2803,62 +2803,7 @@ in ]; }; - sniprun = - let - version = "1.3.16"; - src = fetchFromGitHub { - owner = "michaelb"; - repo = "sniprun"; - rev = "refs/tags/v${version}"; - hash = "sha256-2rVeBUkdLXUiHkd8slyiLTYQBKwgMQvIi/uyCToVBYA="; - }; - sniprun-bin = rustPlatform.buildRustPackage { - pname = "sniprun-bin"; - inherit version src; - - buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ - darwin.apple_sdk.frameworks.Security - ]; - - cargoHash = "sha256-eZcWS+DWec0V9G6hBnZRUNcb3uZeSiBhn4Ed9KodFV8="; - - nativeBuildInputs = [ makeWrapper ]; - - postInstall = '' - wrapProgram $out/bin/sniprun \ - --prefix PATH ${ - lib.makeBinPath [ - bashInteractive - coreutils - curl - gnugrep - gnused - procps - ] - } - ''; - - doCheck = false; - }; - in - buildVimPlugin { - pname = "sniprun"; - inherit version src; - - patches = [ ./patches/sniprun/fix-paths.patch ]; - postPatch = '' - substituteInPlace lua/sniprun.lua --replace '@sniprun_bin@' ${sniprun-bin} - ''; - - propagatedBuildInputs = [ sniprun-bin ]; - - meta = { - homepage = "https://github.com/michaelb/sniprun/"; - changelog = "https://github.com/michaelb/sniprun/blob/v${version}/CHANGELOG.md"; - maintainers = with lib.maintainers; [ GaetanLepage ]; - }; - nvimRequireCheck = "sniprun"; - }; + sniprun = callPackage ./sniprun { }; # The GitHub repository returns 404, which breaks the update script Spacegray-vim = buildVimPlugin { diff --git a/pkgs/applications/editors/vim/plugins/sniprun/default.nix b/pkgs/applications/editors/vim/plugins/sniprun/default.nix new file mode 100644 index 000000000000..8ea4a90ca87f --- /dev/null +++ b/pkgs/applications/editors/vim/plugins/sniprun/default.nix @@ -0,0 +1,77 @@ +{ + lib, + fetchFromGitHub, + nix-update-script, + rustPlatform, + vimUtils, + makeWrapper, + bashInteractive, + coreutils, + curl, + gnugrep, + gnused, + procps, +}: +let + version = "1.3.16"; + src = fetchFromGitHub { + owner = "michaelb"; + repo = "sniprun"; + tag = "v${version}"; + hash = "sha256-2rVeBUkdLXUiHkd8slyiLTYQBKwgMQvIi/uyCToVBYA="; + }; + sniprun-bin = rustPlatform.buildRustPackage { + pname = "sniprun-bin"; + inherit version src; + + cargoHash = "sha256-eZcWS+DWec0V9G6hBnZRUNcb3uZeSiBhn4Ed9KodFV8="; + + nativeBuildInputs = [ makeWrapper ]; + + postInstall = '' + wrapProgram $out/bin/sniprun \ + --prefix PATH ${ + lib.makeBinPath [ + bashInteractive + coreutils + curl + gnugrep + gnused + procps + ] + } + ''; + + doCheck = false; + }; +in +vimUtils.buildVimPlugin { + pname = "sniprun"; + inherit version src; + + patches = [ ./fix-paths.patch ]; + + postPatch = '' + substituteInPlace lua/sniprun.lua --replace '@sniprun_bin@' ${sniprun-bin} + ''; + + propagatedBuildInputs = [ sniprun-bin ]; + + nvimRequireCheck = "sniprun"; + + passthru = { + updateScript = nix-update-script { + attrPath = "vimPlugins.sniprun.sniprun-bin"; + }; + + # needed for the update script + inherit sniprun-bin; + }; + + meta = { + homepage = "https://github.com/michaelb/sniprun/"; + changelog = "https://github.com/michaelb/sniprun/blob/${src.tag}/CHANGELOG.md"; + maintainers = with lib.maintainers; [ GaetanLepage ]; + license = lib.licenses.mit; + }; +} diff --git a/pkgs/applications/editors/vim/plugins/patches/sniprun/fix-paths.patch b/pkgs/applications/editors/vim/plugins/sniprun/fix-paths.patch similarity index 100% rename from pkgs/applications/editors/vim/plugins/patches/sniprun/fix-paths.patch rename to pkgs/applications/editors/vim/plugins/sniprun/fix-paths.patch