emacsPackages.lsp-bridge: fix passthru.updateScript

Emacs packages require a version string compatible with
`package-build.el`, which differs from `unstableGitUpdater`.
This commit is contained in:
Mario Rodas 2024-04-21 04:20:00 +00:00
parent 3a82632c9b
commit 30de194f80
1 changed files with 17 additions and 2 deletions

View File

@ -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";