1 { lib, stdenv, jre, coursier, makeWrapper, setJavaClassPath }:
6 deps = stdenv.mkDerivation {
7 name = "${baseName}-deps-${version}";
9 export COURSIER_CACHE=$(pwd)
10 ${coursier}/bin/cs fetch org.scalameta:scalafmt-cli_2.13:${version} > deps
11 mkdir -p $out/share/java
12 cp $(< deps) $out/share/java/
14 outputHashMode = "recursive";
15 outputHash = "sha256-r4vv62H0AryjZb+34fVHvqvndipOYyf6XpQC9u8Dxso=";
22 nativeBuildInputs = [ makeWrapper setJavaClassPath ];
23 buildInputs = [ deps ];
30 makeWrapper ${jre}/bin/java $out/bin/${baseName} \
31 --add-flags "-cp $CLASSPATH org.scalafmt.cli.Cli"
36 installCheckPhase = ''
37 $out/bin/${baseName} --version | grep -q "${version}"
41 description = "Opinionated code formatter for Scala";
42 homepage = "http://scalameta.org/scalafmt";
43 license = licenses.asl20;
44 maintainers = [ maintainers.markus1189 ];
45 mainProgram = "scalafmt";