Unverified Commit 8386a426 authored by Lin Jian's avatar Lin Jian
Browse files

emacsPackages.lsp-bridge: clean

parent afbd9afe
Loading
Loading
Loading
Loading
+14 −37
Original line number Diff line number Diff line
@@ -11,12 +11,10 @@
, pyright
, ruff
, tempel
, writeScript
, writeText
, unstableGitUpdater
}:

let
  rev = "9e88e660d717ba597d9fe9366cf4278674734410";
  python = python3.withPackages (ps: with ps; [
    epc
    orjson
@@ -29,17 +27,15 @@ let
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 +60,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 +83,12 @@ 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"

    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"
  '';
  passthru.updateScript = unstableGitUpdater { hardcodeZeroVersion = true; };

  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 ];
  };
}