depot/third_party/nixpkgs/pkgs/development/tools/language-servers/metals/default.nix
Default email 6d4aeb4377 Project import generated by Copybara.
GitOrigin-RevId: 0f213d0fee84280d8c3a97f7469b988d6fe5fcdf
2023-01-11 08:51:40 +01:00

42 lines
1.2 KiB
Nix

{ stdenv, lib, coursier, jre, makeWrapper, setJavaClassPath }:
stdenv.mkDerivation rec {
pname = "metals";
version = "0.11.10";
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 -n $(< deps) $out/share/java/
'';
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "sha256-CNLBDsyiEOmMGA9r8eU+3z75VYps21kHnLpB1LYC7W4=";
};
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 = "Work-in-progress language server for Scala";
maintainers = with maintainers; [ fabianhjr tomahna ];
};
}