nixpkgs/pkgs/development/tools/metals/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.2 KiB
Nix
Raw Normal View History

2022-05-03 02:40:48 +00:00
{ stdenv, lib, coursier, jre, makeWrapper, setJavaClassPath }:
2019-04-27 16:57:03 +00:00
2020-07-16 21:28:37 +00:00
stdenv.mkDerivation rec {
pname = "metals";
2022-08-17 08:09:06 +00:00
version = "0.11.8";
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)
2022-05-03 02:40:48 +00:00
${coursier}/bin/cs fetch org.scalameta:metals_2.13:${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";
2022-08-17 08:09:06 +00:00
outputHash = "sha256-j7je+ZBTIkRfOPpUWbwz4JR06KprMn8sZXONrtI/n8s=";
2019-04-27 16:57:03 +00:00
};
2022-05-03 02:40:48 +00:00
nativeBuildInputs = [ makeWrapper setJavaClassPath ];
buildInputs = [ deps ];
2019-04-27 16:57:03 +00:00
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
makeWrapper ${jre}/bin/java $out/bin/metals \
--add-flags "${extraJavaOpts} -cp $CLASSPATH scala.meta.metals.Main"
2019-04-27 16:57:03 +00:00
'';
meta = with lib; {
homepage = "https://scalameta.org/metals/";
2019-04-27 16:57:03 +00:00
license = licenses.asl20;
description = "Work-in-progress language server for Scala";
maintainers = with maintainers; [ fabianhjr tomahna ];
2019-04-27 16:57:03 +00:00
};
}