3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/tools/scalafix/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

47 lines
1.3 KiB
Nix
Raw Normal View History

{ lib, stdenv, jre, coursier, makeWrapper, installShellFiles, setJavaClassPath }:
2018-10-24 18:00:00 +01:00
let
baseName = "scalafix";
version = "0.10.0";
2018-10-24 18:00:00 +01:00
deps = stdenv.mkDerivation {
name = "${baseName}-deps-${version}";
buildCommand = ''
export COURSIER_CACHE=$(pwd)
${coursier}/bin/cs fetch ch.epfl.scala:scalafix-cli_2.13.8:${version} > deps
2018-10-24 18:00:00 +01:00
mkdir -p $out/share/java
cp $(< deps) $out/share/java/
'';
outputHashMode = "recursive";
outputHash = "sha256-lDeg90L484MggtQ2a9OyHv4UcfLPjzG3OJZCaWW2AC8=";
2018-10-24 18:00:00 +01:00
};
in
2019-08-13 22:52:01 +01:00
stdenv.mkDerivation {
pname = baseName;
inherit version;
2018-10-24 18:00:00 +01:00
nativeBuildInputs = [ makeWrapper installShellFiles setJavaClassPath ];
buildInputs = [ deps ];
2018-10-24 18:00:00 +01:00
dontUnpack = true;
2018-10-24 18:00:00 +01:00
installPhase = ''
makeWrapper ${jre}/bin/java $out/bin/${baseName} \
--add-flags "-cp $CLASSPATH scalafix.cli.Cli"
installShellCompletion --cmd ${baseName} \
--bash <($out/bin/${baseName} --bash) \
--zsh <($out/bin/${baseName} --zsh)
2018-10-24 18:00:00 +01:00
'';
installCheckPhase = ''
2018-10-24 18:00:00 +01:00
$out/bin/${baseName} --version | grep -q "${version}"
'';
meta = with lib; {
2018-10-24 18:00:00 +01:00
description = "Refactoring and linting tool for Scala";
homepage = "https://scalacenter.github.io/scalafix/";
2018-10-24 18:00:00 +01:00
license = licenses.bsd3;
maintainers = [ maintainers.tomahna ];
};
}