Unverified Commit 3a4373ef authored by Kira Bruneau's avatar Kira Bruneau Committed by GitHub
Browse files

Merge pull request #327901 from linj-fork/pr/clean-lsp-bridge

emacsPackages.lsp-bridge: clean
parents 1c6c866a 5a996492
Loading
Loading
Loading
Loading
+42 −59
Original line number Diff line number Diff line
{ lib
, python3
, melpaBuild
, fetchFromGitHub
, substituteAll
, acm
, markdown-mode
, git
, go
, gopls
, pyright
, ruff
, tempel
, writeScript
, writeText
{
  lib,
  python3,
  melpaBuild,
  fetchFromGitHub,
  substituteAll,
  acm,
  markdown-mode,
  git,
  go,
  gopls,
  pyright,
  ruff,
  tempel,
  unstableGitUpdater,
}:

let
  rev = "9e88e660d717ba597d9fe9366cf4278674734410";
  python = python3.withPackages (ps: with ps; [
  python = python3.withPackages (
    ps: with ps; [
      epc
      orjson
      paramiko
@@ -25,21 +25,20 @@ let
      setuptools
      sexpdata
      six
  ]);
    ]
  );
in
melpaBuild {
  pname = "lsp-bridge";
  version = "20240629.1404";
  version = "0-unstable-2024-06-29";

  src = fetchFromGitHub {
    owner = "manateelazycat";
    repo = "lsp-bridge";
    inherit rev;
    rev = "9e88e660d717ba597d9fe9366cf4278674734410";
    hash = "sha256-qpetTKZDQjoofp8ggothYALQBpwLjuNxCq46Pe4oZZA=";
  };

  commit = rev;

  patches = [
    # Hardcode the python dependencies needed for lsp-bridge, so users
    # don't have to modify their global environment
@@ -64,17 +63,13 @@ melpaBuild {
    tempel
  ];

  recipe = writeText "recipe" ''
    (lsp-bridge
      :repo "manateelazycat/lsp-bridge"
      :fetcher github
      :files
  files = ''
    ("*.el"
     "lsp_bridge.py"
     "core"
     "langserver"
     "multiserver"
       "resources"))
     "resources")
  '';

  doCheck = true;
@@ -91,27 +86,15 @@ melpaBuild {

  __darwinAllowLocalNetworking = true;

  passthru.updateScript = writeScript "update.sh" ''
    #!/usr/bin/env nix-shell
    #!nix-shell -i bash -p common-updater-scripts coreutils git gnused
    set -eu -o pipefail

    tmpdir="$(mktemp -d)"
    git clone --depth=1 https://github.com/manateelazycat/lsp-bridge.git "$tmpdir"
  passthru.updateScript = unstableGitUpdater { hardcodeZeroVersion = true; };

    pushd "$tmpdir"
    commit=$(git show -s --pretty='format:%H')
    # Based on: https://github.com/melpa/melpa/blob/2d8716906a0c9e18d6c979d8450bf1d15dd785eb/package-build/package-build.el#L523-L533
    version=$(TZ=UTC git show -s --pretty='format:%cd' --date='format-local:%Y%m%d.%H%M' | sed 's|\.0*|.|')
    popd

    update-source-version emacsPackages.lsp-bridge $version --rev="$commit"
  '';

  meta = with lib; {
  meta = {
    description = "Blazingly fast LSP client for Emacs";
    homepage = "https://github.com/manateelazycat/lsp-bridge";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ fxttr kira-bruneau ];
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [
      fxttr
      kira-bruneau
    ];
  };
}