2021-12-06 16:07:01 +00:00
|
|
|
{ lib, stdenv, buildGraalvmNativeImage, babashka, fetchurl, fetchFromGitHub, clojure, writeScript }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
buildGraalvmNativeImage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "clojure-lsp";
|
2022-06-26 10:26:21 +00:00
|
|
|
version = "2022.06.22-14.09.50";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-19 19:06:45 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2022-06-26 10:26:21 +00:00
|
|
|
sha256 = "sha256-QMzjoxcEbzOZKh3nN+kMwjp5NfARBFiVnZ/1B3yzVK0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-04-26 19:14:03 +00:00
|
|
|
jar = fetchurl {
|
2022-01-23 02:10:13 +00:00
|
|
|
url = "https://github.com/clojure-lsp/clojure-lsp/releases/download/${version}/clojure-lsp-standalone.jar";
|
2022-06-26 10:26:21 +00:00
|
|
|
sha256 = "ff400595723af878f5d6edfed78d403eb1ce18bd439d4bb0eb8eccf3d20a2b51";
|
2021-02-19 19:06:45 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
extraNativeImageBuildArgs = [
|
|
|
|
"--no-fallback"
|
|
|
|
"--native-image-info"
|
|
|
|
];
|
2021-02-19 19:06:45 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
export HOME="$(mktemp -d)"
|
2021-12-06 16:07:01 +00:00
|
|
|
./${pname} --version | fgrep -q '${version}'
|
2022-01-13 20:06:32 +00:00
|
|
|
''
|
|
|
|
# TODO: fix classpath issue per https://github.com/NixOS/nixpkgs/pull/153770
|
|
|
|
#${babashka}/bin/bb integration-test ./${pname}
|
|
|
|
+ ''
|
2021-02-19 19:06:45 +00:00
|
|
|
runHook postCheck
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-09-22 15:38:15 +00:00
|
|
|
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)
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
old_jar_hash=$(nix-instantiate --eval --strict -A "clojure-lsp.jar.drvAttrs.outputHash" | tr -d '"' | sed -re 's|[+]|\\&|g')
|
2021-09-22 15:38:15 +00:00
|
|
|
|
2022-03-30 09:31:56 +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-23 02:10:13 +00:00
|
|
|
new_jar_hash=$(nix-hash --flat --type sha256 clojure-lsp-standalone.jar | sed -re 's|[+]|\\&|g')
|
2021-09-22 15:38:15 +00:00
|
|
|
|
2022-01-23 02:10:13 +00:00
|
|
|
rm -f clojure-lsp-standalone.jar
|
2021-09-22 15:38:15 +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-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Language Server Protocol (LSP) for Clojure";
|
2021-04-26 19:14:03 +00:00
|
|
|
homepage = "https://github.com/clojure-lsp/clojure-lsp";
|
2022-06-16 17:23:12 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
2021-06-28 23:13:55 +00:00
|
|
|
maintainers = with maintainers; [ ericdallo babariviere ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|