2021-09-14 14:26:21 +00:00
|
|
|
{ lib, stdenv, graalvm11-ce, babashka, fetchurl, fetchFromGitHub, clojure, writeScript }:
|
2019-12-06 23:45:12 +00:00
|
|
|
|
2021-04-21 17:55:55 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-12-06 23:45:12 +00:00
|
|
|
pname = "clojure-lsp";
|
2021-09-12 16:35:03 +00:00
|
|
|
version = "2021.09.04-17.11.44";
|
2019-12-06 23:45:12 +00:00
|
|
|
|
2021-02-05 14:13:00 +00:00
|
|
|
src = fetchFromGitHub {
|
2021-02-04 03:56:20 +00:00
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2021-09-12 16:35:03 +00:00
|
|
|
sha256 = "1i12vxg3yb1051q7j6yqlsdy4lc4xl7n4lqssp8w634fpx1p0rgv";
|
2021-02-05 14:13:00 +00:00
|
|
|
};
|
|
|
|
|
2021-04-21 17:55:55 +00:00
|
|
|
jar = fetchurl {
|
2021-09-14 14:26:21 +00:00
|
|
|
url =
|
|
|
|
"https://github.com/clojure-lsp/clojure-lsp/releases/download/${version}/clojure-lsp.jar";
|
2021-09-12 16:35:03 +00:00
|
|
|
sha256 = "0ahrlqzyz3mgfx8w9w49172pb3dipq0hwwzk2yasqzcp1fi6jm80";
|
2021-02-04 03:56:20 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 14:13:00 +00:00
|
|
|
GRAALVM_HOME = graalvm11-ce;
|
2021-04-21 17:55:55 +00:00
|
|
|
CLOJURE_LSP_JAR = jar;
|
2021-06-23 10:24:20 +00:00
|
|
|
CLOJURE_LSP_XMX = "-J-Xmx4g";
|
|
|
|
|
2021-07-12 19:20:44 +00:00
|
|
|
buildInputs = [ graalvm11-ce clojure ];
|
2021-02-04 03:06:28 +00:00
|
|
|
|
|
|
|
buildPhase = with lib; ''
|
2021-02-05 14:13:00 +00:00
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
bash ./graalvm/native-unix-compile.sh
|
|
|
|
|
|
|
|
runHook postBuild
|
2021-02-04 03:06:28 +00:00
|
|
|
'';
|
2020-12-28 15:59:15 +00:00
|
|
|
|
2019-12-06 23:45:12 +00:00
|
|
|
installPhase = ''
|
2021-02-05 14:13:00 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install -Dm755 ./clojure-lsp $out/bin/clojure-lsp
|
|
|
|
|
|
|
|
runHook postInstall
|
2021-02-04 03:06:28 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-04 03:56:20 +00:00
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
2021-02-05 14:13:00 +00:00
|
|
|
runHook preCheck
|
|
|
|
|
2021-06-09 17:21:39 +00:00
|
|
|
export HOME="$(mktemp -d)"
|
|
|
|
./clojure-lsp --version | fgrep -q '${version}'
|
2021-09-12 16:35:03 +00:00
|
|
|
${babashka}/bin/bb integration-test ./clojure-lsp
|
2021-02-05 14:13:00 +00:00
|
|
|
|
|
|
|
runHook postCheck
|
2019-12-06 23:45:12 +00:00
|
|
|
'';
|
|
|
|
|
2021-09-14 14:26:21 +00:00
|
|
|
passthru.updateScript = writeScript "update-clojure-lsp" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl common-updater-scripts
|
|
|
|
|
|
|
|
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"
|
|
|
|
'';
|
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
meta = with lib; {
|
2019-12-06 23:45:12 +00:00
|
|
|
description = "Language Server Protocol (LSP) for Clojure";
|
2021-04-21 17:55:55 +00:00
|
|
|
homepage = "https://github.com/clojure-lsp/clojure-lsp";
|
2019-12-06 23:45:12 +00:00
|
|
|
license = licenses.mit;
|
2021-06-23 11:47:54 +00:00
|
|
|
maintainers = with maintainers; [ ericdallo babariviere ];
|
2021-02-04 03:06:28 +00:00
|
|
|
platforms = graalvm11-ce.meta.platforms;
|
2019-12-06 23:45:12 +00:00
|
|
|
};
|
|
|
|
}
|