2016-05-09 17:41:21 +00:00
|
|
|
{ stdenv, fetchurl, unzip, jre }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2017-02-24 19:01:42 +00:00
|
|
|
version = "0.5.7";
|
2016-05-09 17:41:21 +00:00
|
|
|
baseName = "scalafmt";
|
|
|
|
name = "${baseName}-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/olafurpg/scalafmt/releases/download/v${version}/${baseName}.tar.gz";
|
2017-02-24 19:01:42 +00:00
|
|
|
sha256 = "1jg2yhnzlyxg735b6qcj3pgnr5q2i361ql27qmxk977al24v5w8i";
|
2016-05-09 17:41:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
unpackPhase = "tar xvzf $src";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
mkdir -p "$out/lib"
|
|
|
|
|
|
|
|
cp cli/target/scala-2.11/scalafmt.jar "$out/lib/${name}.jar"
|
|
|
|
|
|
|
|
cat > "$out/bin/${baseName}" << EOF
|
|
|
|
#!${stdenv.shell}
|
|
|
|
exec ${jre}/bin/java -jar "$out/lib/${name}.jar" "\$@"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
chmod a+x "$out/bin/${baseName}"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Opinionated code formatter for Scala";
|
|
|
|
homepage = http://scalafmt.org;
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.markus1189 ];
|
|
|
|
};
|
|
|
|
}
|