nixpkgs-suyu/pkgs/development/tools/scalafmt/default.nix

37 lines
917 B
Nix
Raw Normal View History

2016-05-09 19:41:21 +02:00
{ stdenv, fetchurl, unzip, jre }:
stdenv.mkDerivation rec {
2016-06-03 13:11:16 +02:00
version = "0.2.5";
2016-05-09 19:41:21 +02:00
baseName = "scalafmt";
name = "${baseName}-${version}";
src = fetchurl {
url = "https://github.com/olafurpg/scalafmt/releases/download/v${version}/${baseName}.tar.gz";
2016-06-03 13:11:16 +02:00
sha256 = "07l95xdwgdbdfa91pg1sds82aw3c60gxzdcvdhhhk6a7zwrl73cp";
2016-05-09 19:41:21 +02: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 ];
};
}