From 9a966071d7e0a41ef1fda6c3c0a4b28b6c95976a Mon Sep 17 00:00:00 2001 From: Kevin Rauscher Date: Sat, 27 Apr 2019 18:57:03 +0200 Subject: [PATCH] metals: init at 0.7.6 --- pkgs/development/tools/metals/default.nix | 57 +++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 1 + 2 files changed, 58 insertions(+) create mode 100644 pkgs/development/tools/metals/default.nix diff --git a/pkgs/development/tools/metals/default.nix b/pkgs/development/tools/metals/default.nix new file mode 100644 index 000000000000..415479edc84d --- /dev/null +++ b/pkgs/development/tools/metals/default.nix @@ -0,0 +1,57 @@ +{ stdenv, lib, coursier, jdk, jre, makeWrapper }: + +let + baseName = "metals"; + version = "0.7.6"; + 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"; + outputHash = "03vx8n77mndpqbvq14cy3k9r4jwgjacrv56v5n87da8rqiclx37j"; + }; +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; { + homepage = https://scalameta.org/metals/; + license = licenses.asl20; + description = "Work-in-progress language server for Scala"; + maintainers = with maintainers; [ ceedubs tomahna ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 336408961b67..ddfe765c4d6f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8401,6 +8401,7 @@ in scala_2_13 = callPackage ../development/compilers/scala/2.13.nix { jre = jre8; }; scala = scala_2_13; + metals = callPackage ../development/tools/metals { }; scalafix = callPackage ../development/tools/scalafix { }; scalafmt = callPackage ../development/tools/scalafmt { };