2021-02-08 14:12:07 +03:00
|
|
|
{ stdenv, jdk, jre, coursier, makeWrapper, lib }:
|
2019-06-27 19:47:42 +03:00
|
|
|
|
|
|
|
let
|
|
|
|
baseName = "scalafmt";
|
2021-10-08 16:36:36 +03:00
|
|
|
version = "3.0.6";
|
2019-06-27 19:47:42 +03:00
|
|
|
deps = stdenv.mkDerivation {
|
|
|
|
name = "${baseName}-deps-${version}";
|
|
|
|
buildCommand = ''
|
|
|
|
export COURSIER_CACHE=$(pwd)
|
2019-12-06 15:56:07 +03:00
|
|
|
${coursier}/bin/coursier fetch org.scalameta:scalafmt-cli_2.12:${version} > deps
|
2019-06-27 19:47:42 +03:00
|
|
|
mkdir -p $out/share/java
|
|
|
|
cp $(< deps) $out/share/java/
|
|
|
|
'';
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHashAlgo = "sha256";
|
2021-10-08 16:36:36 +03:00
|
|
|
outputHash = "0wsly5fhpywwrcz3pkcpyrzk43w887dfnyv70l4rkicd599arwy5";
|
2019-06-27 19:47:42 +03:00
|
|
|
};
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "${baseName}-${version}";
|
|
|
|
|
|
|
|
buildInputs = [ jdk makeWrapper deps ];
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
phases = [ "installPhase" "checkPhase" ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
makeWrapper ${jre}/bin/java $out/bin/${baseName} \
|
|
|
|
--add-flags "-cp $CLASSPATH org.scalafmt.cli.Cli"
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
$out/bin/${baseName} --version | grep -q "${version}"
|
|
|
|
'';
|
|
|
|
|
2021-02-08 14:12:07 +03:00
|
|
|
meta = with lib; {
|
2019-06-27 19:47:42 +03:00
|
|
|
description = "Opinionated code formatter for Scala";
|
|
|
|
homepage = http://scalafmt.org;
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = [ maintainers.markus1189 ];
|
|
|
|
};
|
|
|
|
}
|