2019-04-27 18:57:03 +02:00
|
|
|
{ stdenv, lib, coursier, jdk, jre, makeWrapper }:
|
|
|
|
|
|
|
|
let
|
|
|
|
baseName = "metals";
|
2020-03-20 13:31:34 +01:00
|
|
|
version = "0.8.4";
|
2019-04-27 18:57:03 +02:00
|
|
|
deps = stdenv.mkDerivation {
|
|
|
|
name = "${baseName}-deps-${version}";
|
|
|
|
buildCommand = ''
|
|
|
|
export COURSIER_CACHE=$(pwd)
|
|
|
|
${coursier}/bin/coursier fetch org.scalameta:metals_2.12:${version} \
|
|
|
|
-r bintray:scalacenter/releases \
|
|
|
|
-r sonatype:snapshots > deps
|
|
|
|
mkdir -p $out/share/java
|
|
|
|
cp -n $(< deps) $out/share/java/
|
|
|
|
'';
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHashAlgo = "sha256";
|
2020-03-20 13:31:34 +01:00
|
|
|
outputHash = "1r8aff082m3kh6wy5diyvq8bzg5x4dp1da9sfz223ii0kc1yp6w5";
|
2019-04-27 18:57:03 +02:00
|
|
|
};
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "${baseName}-${version}";
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ jdk deps ];
|
|
|
|
|
|
|
|
phases = [ "installPhase" ];
|
|
|
|
|
|
|
|
extraJavaOpts = "-XX:+UseG1GC -XX:+UseStringDeduplication -Xss4m -Xms100m";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
|
|
|
|
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"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://scalameta.org/metals/";
|
2019-04-27 18:57:03 +02:00
|
|
|
license = licenses.asl20;
|
|
|
|
description = "Work-in-progress language server for Scala";
|
|
|
|
maintainers = with maintainers; [ ceedubs tomahna ];
|
|
|
|
};
|
|
|
|
}
|