depot/third_party/nixpkgs/pkgs/development/tools/language-servers/metals/default.nix
Default email 159e378cbb Project import generated by Copybara.
GitOrigin-RevId: c04d5652cfa9742b1d519688f65d1bbccea9eb7e
2024-09-19 17:19:46 +03:00

43 lines
1.2 KiB
Nix

{ stdenv, lib, coursier, jre, makeWrapper, setJavaClassPath }:
stdenv.mkDerivation rec {
pname = "metals";
version = "1.3.5";
deps = stdenv.mkDerivation {
name = "${pname}-deps-${version}";
buildCommand = ''
export COURSIER_CACHE=$(pwd)
${coursier}/bin/cs fetch org.scalameta:metals_2.13:${version} \
-r bintray:scalacenter/releases \
-r sonatype:snapshots > deps
mkdir -p $out/share/java
cp $(< deps) $out/share/java/
'';
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "sha256-86/zeoOO5kSAwh7uQTV7nGUGQoIux1rlH5eUgvn3kvY=";
};
nativeBuildInputs = [ makeWrapper setJavaClassPath ];
buildInputs = [ deps ];
dontUnpack = true;
extraJavaOpts = "-XX:+UseG1GC -XX:+UseStringDeduplication -Xss4m -Xms100m";
installPhase = ''
mkdir -p $out/bin
makeWrapper ${jre}/bin/java $out/bin/metals \
--add-flags "${extraJavaOpts} -cp $CLASSPATH scala.meta.metals.Main"
'';
meta = with lib; {
homepage = "https://scalameta.org/metals/";
license = licenses.asl20;
description = "Language server for Scala";
mainProgram = "metals";
maintainers = with maintainers; [ fabianhjr jpaju tomahna ];
};
}