2019-04-27 16:57:03 +00:00
|
|
|
{ stdenv, lib, coursier, jdk, jre, makeWrapper }:
|
|
|
|
|
2020-07-16 21:28:37 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "metals";
|
2021-11-03 17:02:31 +00:00
|
|
|
version = "0.10.9";
|
2020-07-16 21:28:37 +00:00
|
|
|
|
2019-04-27 16:57:03 +00:00
|
|
|
deps = stdenv.mkDerivation {
|
2020-07-16 21:28:37 +00:00
|
|
|
name = "${pname}-deps-${version}";
|
2019-04-27 16:57:03 +00:00
|
|
|
buildCommand = ''
|
|
|
|
export COURSIER_CACHE=$(pwd)
|
2021-10-29 00:42:15 +00:00
|
|
|
${coursier}/bin/cs fetch org.scalameta:metals_2.12:${version} \
|
2019-04-27 16:57:03 +00:00
|
|
|
-r bintray:scalacenter/releases \
|
|
|
|
-r sonatype:snapshots > deps
|
|
|
|
mkdir -p $out/share/java
|
|
|
|
cp -n $(< deps) $out/share/java/
|
|
|
|
'';
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHashAlgo = "sha256";
|
2021-11-03 17:02:31 +00:00
|
|
|
outputHash = "sha256-Z0wngo7FP5sHpmPkTwitqTvNL0IEqqWwccy3mZpTIKU=";
|
2019-04-27 16:57:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ jdk deps ];
|
|
|
|
|
2021-07-27 12:37:10 +00:00
|
|
|
dontUnpack = true;
|
2019-04-27 16:57:03 +00:00
|
|
|
|
|
|
|
extraJavaOpts = "-XX:+UseG1GC -XX:+UseStringDeduplication -Xss4m -Xms100m";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
|
2020-05-28 15:43:00 +00:00
|
|
|
# This variant is not targeted at any particular client, clients are
|
|
|
|
# expected to declare their supported features in initialization options.
|
|
|
|
makeWrapper ${jre}/bin/java $out/bin/metals \
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ jdk ]} \
|
|
|
|
--add-flags "${extraJavaOpts} -cp $CLASSPATH scala.meta.metals.Main"
|
|
|
|
|
|
|
|
# Further variants targeted at clients with featuresets pre-set.
|
2019-04-27 16:57:03 +00:00
|
|
|
makeWrapper ${jre}/bin/java $out/bin/metals-emacs \
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ jdk ]} \
|
|
|
|
--add-flags "${extraJavaOpts} -Dmetals.client=emacs -cp $CLASSPATH scala.meta.metals.Main"
|
|
|
|
|
|
|
|
makeWrapper ${jre}/bin/java $out/bin/metals-vim \
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ jdk ]} \
|
|
|
|
--add-flags "${extraJavaOpts} -Dmetals.client=coc.nvim -cp $CLASSPATH scala.meta.metals.Main"
|
|
|
|
|
|
|
|
makeWrapper ${jre}/bin/java $out/bin/metals-vim-lsc \
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ jdk ]} \
|
|
|
|
--add-flags "${extraJavaOpts} -Dmetals.client=vim-lsc -cp $CLASSPATH scala.meta.metals.Main"
|
|
|
|
|
|
|
|
makeWrapper ${jre}/bin/java $out/bin/metals-sublime \
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ jdk ]} \
|
|
|
|
--add-flags "${extraJavaOpts} -Dmetals.client=sublime -cp $CLASSPATH scala.meta.metals.Main"
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://scalameta.org/metals/";
|
2019-04-27 16:57:03 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
description = "Work-in-progress language server for Scala";
|
2021-11-02 14:25:09 +00:00
|
|
|
maintainers = with maintainers; [ fabianhjr tomahna ];
|
2019-04-27 16:57:03 +00:00
|
|
|
};
|
|
|
|
}
|