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

37 lines
918 B
Nix
Raw Normal View History

2016-05-09 18:41:21 +01:00
{ stdenv, fetchurl, unzip, jre }:
stdenv.mkDerivation rec {
2017-04-07 11:42:31 +01:00
version = "0.6.8";
2016-05-09 18:41:21 +01:00
baseName = "scalafmt";
name = "${baseName}-${version}";
src = fetchurl {
2017-03-20 16:43:51 +00:00
url = "https://github.com/scalameta/scalafmt/releases/download/v${version}/${baseName}.tar.gz";
2017-04-07 11:42:31 +01:00
sha256 = "1iaanrxk5lhxx1zj9gbxzgqbnyy1azfrab984mga7di5z1hs02s2";
2016-05-09 18:41:21 +01: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 ];
};
}