blob: 88bbfda5c73f6062cc78450c956a39a59dac5ca7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
{ stdenv, lib, coursier, jdk, jre, makeWrapper }:
stdenv.mkDerivation rec {
pname = "metals";
version = "0.10.3";
deps = stdenv.mkDerivation {
name = "${pname}-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";
outputHash = "1psmsiwd3xlbrvkdvr2zgs2b66kw8w2jvvqa399g7jhixh2fpbx4";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ jdk deps ];
phases = [ "installPhase" ];
extraJavaOpts = "-XX:+UseG1GC -XX:+UseStringDeduplication -Xss4m -Xms100m";
installPhase = ''
mkdir -p $out/bin
# 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.
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 lib; {
homepage = "https://scalameta.org/metals/";
license = licenses.asl20;
description = "Work-in-progress language server for Scala";
maintainers = with maintainers; [ ceedubs tomahna ];
};
}
|