2021-11-23 15:26:19 +00:00
|
|
|
{ lib, stdenv, buildGraalvmNativeImage, babashka, fetchurl, fetchFromGitHub, clojure, writeScript }:
|
2019-12-06 23:45:12 +00:00
|
|
|
|
2021-11-23 14:56:37 +00:00
|
|
|
buildGraalvmNativeImage rec {
|
2019-12-06 23:45:12 +00:00
|
|
|
pname = "clojure-lsp";
|
2023-04-21 16:34:17 +00:00
|
|
|
version = "2023.04.19-12.43.29";
|
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;
|
2023-04-21 16:34:17 +00:00
|
|
|
sha256 = "sha256-Y3zBkNp8rTQY8yjSeZDIKHgpMEDLe3XBlEWeuc5H3mk=";
|
2021-02-05 14:13:00 +00:00
|
|
|
};
|
|
|
|
|
2021-04-21 17:55:55 +00:00
|
|
|
jar = fetchurl {
|
2022-01-22 22:58:45 +00:00
|
|
|
url = "https://github.com/clojure-lsp/clojure-lsp/releases/download/${version}/clojure-lsp-standalone.jar";
|
2023-04-21 16:34:17 +00:00
|
|
|
sha256 = "df6b582a39183c271a8d00ddf4e3cf020b9e872e6fad2c13bf7de46e940ff4d6";
|
2021-02-04 03:56:20 +00:00
|
|
|
};
|
|
|
|
|
2021-11-23 14:56:37 +00:00
|
|
|
extraNativeImageBuildArgs = [
|
|
|
|
"--no-fallback"
|
|
|
|
"--native-image-info"
|
|
|
|
];
|
2021-02-05 14:13:00 +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)"
|
2021-11-23 15:35:55 +00:00
|
|
|
./${pname} --version | fgrep -q '${version}'
|
2022-01-10 15:28:17 +00:00
|
|
|
''
|
|
|
|
# TODO: fix classpath issue per https://github.com/NixOS/nixpkgs/pull/153770
|
|
|
|
#${babashka}/bin/bb integration-test ./${pname}
|
|
|
|
+ ''
|
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
|
2021-09-14 14:26:50 +00:00
|
|
|
#!nix-shell -i bash -p curl common-updater-scripts gnused jq nix
|
2021-09-14 14:26:21 +00:00
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
latest_version=$(curl -s https://api.github.com/repos/clojure-lsp/clojure-lsp/releases/latest | jq --raw-output .tag_name)
|
|
|
|
|
2022-03-28 22:21:29 +00:00
|
|
|
old_jar_hash=$(nix-instantiate --eval --strict -A "clojure-lsp.jar.drvAttrs.outputHash" | tr -d '"' | sed -re 's|[+]|\\&|g')
|
2021-09-14 14:26:21 +00:00
|
|
|
|
2022-03-28 22:21:29 +00:00
|
|
|
curl -o clojure-lsp-standalone.jar -sL https://github.com/clojure-lsp/clojure-lsp/releases/download/$latest_version/clojure-lsp-standalone.jar
|
2022-01-22 22:58:45 +00:00
|
|
|
new_jar_hash=$(nix-hash --flat --type sha256 clojure-lsp-standalone.jar | sed -re 's|[+]|\\&|g')
|
2021-09-14 14:26:21 +00:00
|
|
|
|
2022-01-22 22:58:45 +00:00
|
|
|
rm -f clojure-lsp-standalone.jar
|
2021-09-14 14:26:21 +00:00
|
|
|
|
|
|
|
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";
|
2022-06-02 13:38:41 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
2019-12-06 23:45:12 +00:00
|
|
|
license = licenses.mit;
|
2021-06-23 11:47:54 +00:00
|
|
|
maintainers = with maintainers; [ ericdallo babariviere ];
|
2019-12-06 23:45:12 +00:00
|
|
|
};
|
|
|
|
}
|