Merge pull request #137832 from ericdallo/add-updater-to-clojure-lsp
clojure-lsp: Add updateScript + bump
This commit is contained in:
commit
d050e7dfc3
|
@ -1,19 +1,19 @@
|
|||
{ lib, stdenv, graalvm11-ce, babashka, fetchurl, fetchFromGitHub, clojure }:
|
||||
{ lib, stdenv, graalvm11-ce, babashka, fetchurl, fetchFromGitHub, clojure, writeScript }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "clojure-lsp";
|
||||
version = "2021.09.04-17.11.44";
|
||||
version = "2021.09.13-22.25.35";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = pname;
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "1i12vxg3yb1051q7j6yqlsdy4lc4xl7n4lqssp8w634fpx1p0rgv";
|
||||
sha256 = "0ypn0m81lbhx45y0ajpgk7id9g47l1gnihvqdjxw5m1j2hdwjdzr";
|
||||
};
|
||||
|
||||
jar = fetchurl {
|
||||
url = "https://github.com/clojure-lsp/clojure-lsp/releases/download/${version}/clojure-lsp.jar";
|
||||
sha256 = "0ahrlqzyz3mgfx8w9w49172pb3dipq0hwwzk2yasqzcp1fi6jm80";
|
||||
sha256 = "e93e334a4ada04a28e0b148b8364b9433b8d83f6417249d7bded7cc86d1fe081";
|
||||
};
|
||||
|
||||
GRAALVM_HOME = graalvm11-ce;
|
||||
|
@ -49,6 +49,27 @@ stdenv.mkDerivation rec {
|
|||
runHook postCheck
|
||||
'';
|
||||
|
||||
passthru.updateScript = writeScript "update-clojure-lsp" ''
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl common-updater-scripts gnused jq nix
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
latest_version=$(curl -s https://api.github.com/repos/clojure-lsp/clojure-lsp/releases/latest | jq --raw-output .tag_name)
|
||||
|
||||
old_jar_hash=$(nix-instantiate --eval --strict -A "clojure-lsp.jar.drvAttrs.outputHash" | tr -d '"' | sed -re 's|[+]|\\&|g')
|
||||
|
||||
curl -o clojure-lsp.jar -sL https://github.com/clojure-lsp/clojure-lsp/releases/download/$latest_version/clojure-lsp.jar
|
||||
new_jar_hash=$(nix-hash --flat --type sha256 clojure-lsp.jar | sed -re 's|[+]|\\&|g')
|
||||
|
||||
rm -f clojure-lsp.jar
|
||||
|
||||
nixFile=$(nix-instantiate --eval --strict -A "clojure-lsp.meta.position" | sed -re 's/^"(.*):[0-9]+"$/\1/')
|
||||
|
||||
sed -i "$nixFile" -re "s|\"$old_jar_hash\"|\"$new_jar_hash\"|"
|
||||
update-source-version clojure-lsp "$latest_version"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Language Server Protocol (LSP) for Clojure";
|
||||
homepage = "https://github.com/clojure-lsp/clojure-lsp";
|
||||
|
|
Loading…
Reference in a new issue