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";
|
2023-05-24 13:37:59 +00:00
|
|
|
version = "2023.05.04-19.38.01";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-19 19:06:45 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2023-05-24 13:37:59 +00:00
|
|
|
sha256 = "sha256-TWbOR0/YYO0O+4w2ACADOrp8EmyEfFAq2FQOUDEafjw=";
|
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";
|
2023-05-24 13:37:59 +00:00
|
|
|
sha256 = "48503b147a247cef4c106084b0c15e10bb0f1de8f0b15d528ca9d66e76bba465";
|
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
|
|
|
};
|
|
|
|
}
|