summary refs log tree commit diff
path: root/pkgs/development/tools/scalafmt
diff options
context:
space:
mode:
authorMarkus Hauck <markus1189@gmail.com>2016-05-09 19:41:21 +0200
committerMarkus Hauck <markus1189@gmail.com>2016-05-09 19:57:42 +0200
commit40dae1aba83023024dce253504e4d9c0cc6d8c3f (patch)
tree133042b620dadba31a38410acb97f82b39420b43 /pkgs/development/tools/scalafmt
parent4a04f2d51151f6e9039c3929afe452034c170182 (diff)
downloadnixpkgs-40dae1aba83023024dce253504e4d9c0cc6d8c3f.tar
nixpkgs-40dae1aba83023024dce253504e4d9c0cc6d8c3f.tar.gz
nixpkgs-40dae1aba83023024dce253504e4d9c0cc6d8c3f.tar.bz2
nixpkgs-40dae1aba83023024dce253504e4d9c0cc6d8c3f.tar.lz
nixpkgs-40dae1aba83023024dce253504e4d9c0cc6d8c3f.tar.xz
nixpkgs-40dae1aba83023024dce253504e4d9c0cc6d8c3f.tar.zst
nixpkgs-40dae1aba83023024dce253504e4d9c0cc6d8c3f.zip
scalafmt: init at 0.2.3
Diffstat (limited to 'pkgs/development/tools/scalafmt')
-rw-r--r--pkgs/development/tools/scalafmt/default.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/pkgs/development/tools/scalafmt/default.nix b/pkgs/development/tools/scalafmt/default.nix
new file mode 100644
index 00000000000..b909c646555
--- /dev/null
+++ b/pkgs/development/tools/scalafmt/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, unzip, jre }:
+
+stdenv.mkDerivation rec {
+  version = "0.2.3";
+  baseName = "scalafmt";
+  name = "${baseName}-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/olafurpg/scalafmt/releases/download/v${version}/${baseName}.tar.gz";
+    sha256 = "0klzm86771wl6d8cq5cf4a4mfz8idcis6wrg0x2ix5rcc5zi0d4d";
+  };
+
+  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 ];
+  };
+}