Commit 30de194f authored by Mario Rodas's avatar Mario Rodas
Browse files

emacsPackages.lsp-bridge: fix passthru.updateScript

Emacs packages require a version string compatible with
`package-build.el`, which differs from `unstableGitUpdater`.
parent 3a82632c
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -11,8 +11,8 @@
, pyright
, ruff
, tempel
, writeScript
, writeText
, unstableGitUpdater
}:

let
@@ -88,7 +88,22 @@ melpaBuild {
    runHook postCheck
  '';

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

  meta = with lib; {
    description = "A blazingly fast LSP client for Emacs";