mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-11 04:02:55 +03:00
4558d28cfc
* scalafix: 0.9.0 -> 0.10.0 Bump scala version 2.12.7 -> 2.13.8 (latest AFAICT), as well. Prefer hash format that matches what nix outputs these days for easier updating. * scalafix: shell completion (bash, zsh) * scalafix: use setJavaClassPath, drop jdk dep No need to pull in entire JDK just to use the setup-hook.
47 lines
1.3 KiB
Nix
47 lines
1.3 KiB
Nix
{ lib, stdenv, jre, coursier, makeWrapper, installShellFiles, setJavaClassPath }:
|
|
|
|
let
|
|
baseName = "scalafix";
|
|
version = "0.10.0";
|
|
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
|
|
mkdir -p $out/share/java
|
|
cp $(< deps) $out/share/java/
|
|
'';
|
|
outputHashMode = "recursive";
|
|
outputHash = "sha256-lDeg90L484MggtQ2a9OyHv4UcfLPjzG3OJZCaWW2AC8=";
|
|
};
|
|
in
|
|
stdenv.mkDerivation {
|
|
pname = baseName;
|
|
inherit version;
|
|
|
|
nativeBuildInputs = [ makeWrapper installShellFiles setJavaClassPath ];
|
|
buildInputs = [ deps ];
|
|
|
|
dontUnpack = true;
|
|
|
|
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)
|
|
'';
|
|
|
|
installCheckPhase = ''
|
|
$out/bin/${baseName} --version | grep -q "${version}"
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Refactoring and linting tool for Scala";
|
|
homepage = "https://scalacenter.github.io/scalafix/";
|
|
license = licenses.bsd3;
|
|
maintainers = [ maintainers.tomahna ];
|
|
};
|
|
}
|