2022-04-27 09:35:20 +00:00
|
|
|
{ stdenv, lib, coursier, jre, makeWrapper, setJavaClassPath }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "metals";
|
2023-04-29 16:46:19 +00:00
|
|
|
version = "0.11.12";
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
deps = stdenv.mkDerivation {
|
2020-07-18 16:06:22 +00:00
|
|
|
name = "${pname}-deps-${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
buildCommand = ''
|
|
|
|
export COURSIER_CACHE=$(pwd)
|
2022-04-27 09:35:20 +00:00
|
|
|
${coursier}/bin/cs fetch org.scalameta:metals_2.13:${version} \
|
2020-04-24 23:36:52 +00:00
|
|
|
-r bintray:scalacenter/releases \
|
|
|
|
-r sonatype:snapshots > deps
|
|
|
|
mkdir -p $out/share/java
|
2023-07-15 17:15:38 +00:00
|
|
|
cp $(< deps) $out/share/java/
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHashAlgo = "sha256";
|
2023-04-29 16:46:19 +00:00
|
|
|
outputHash = "sha256-3zYjjrd3Hc2T4vwnajiAMNfTDUprKJZnZp2waRLQjI4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper setJavaClassPath ];
|
|
|
|
buildInputs = [ deps ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
dontUnpack = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
extraJavaOpts = "-XX:+UseG1GC -XX:+UseStringDeduplication -Xss4m -Xms100m";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
|
2020-05-29 06:06:01 +00:00
|
|
|
makeWrapper ${jre}/bin/java $out/bin/metals \
|
|
|
|
--add-flags "${extraJavaOpts} -cp $CLASSPATH scala.meta.metals.Main"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://scalameta.org/metals/";
|
|
|
|
license = licenses.asl20;
|
|
|
|
description = "Work-in-progress language server for Scala";
|
2021-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ fabianhjr tomahna ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|