scalafix: 0.9.0 -> 0.10.0, completions, setup-hook instead of jdk (#171074)

* 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.
This commit is contained in:
Will Dietz 2022-05-02 21:34:51 -05:00 committed by GitHub
parent d60e768cb1
commit 4558d28cfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View file

@ -1,33 +1,36 @@
{ lib, stdenv, jdk, jre, coursier, makeWrapper }: { lib, stdenv, jre, coursier, makeWrapper, installShellFiles, setJavaClassPath }:
let let
baseName = "scalafix"; baseName = "scalafix";
version = "0.9.0"; version = "0.10.0";
deps = stdenv.mkDerivation { deps = stdenv.mkDerivation {
name = "${baseName}-deps-${version}"; name = "${baseName}-deps-${version}";
buildCommand = '' buildCommand = ''
export COURSIER_CACHE=$(pwd) export COURSIER_CACHE=$(pwd)
${coursier}/bin/cs fetch ch.epfl.scala:scalafix-cli_2.12.7:${version} > deps ${coursier}/bin/cs fetch ch.epfl.scala:scalafix-cli_2.13.8:${version} > deps
mkdir -p $out/share/java mkdir -p $out/share/java
cp $(< deps) $out/share/java/ cp $(< deps) $out/share/java/
''; '';
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHashAlgo = "sha256"; outputHash = "sha256-lDeg90L484MggtQ2a9OyHv4UcfLPjzG3OJZCaWW2AC8=";
outputHash = "19j260prx7k010nxyvc1m9jj1ncxr73m2cym7if39360v5dc05c0";
}; };
in in
stdenv.mkDerivation { stdenv.mkDerivation {
pname = baseName; pname = baseName;
inherit version; inherit version;
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper installShellFiles setJavaClassPath ];
buildInputs = [ jdk deps ]; buildInputs = [ deps ];
dontUnpack = true; dontUnpack = true;
installPhase = '' installPhase = ''
makeWrapper ${jre}/bin/java $out/bin/${baseName} \ makeWrapper ${jre}/bin/java $out/bin/${baseName} \
--add-flags "-cp $CLASSPATH scalafix.cli.Cli" --add-flags "-cp $CLASSPATH scalafix.cli.Cli"
installShellCompletion --cmd ${baseName} \
--bash <($out/bin/${baseName} --bash) \
--zsh <($out/bin/${baseName} --zsh)
''; '';
installCheckPhase = '' installCheckPhase = ''

View file

@ -13815,7 +13815,6 @@ with pkgs;
metals = callPackage ../development/tools/metals { }; metals = callPackage ../development/tools/metals { };
scalafix = callPackage ../development/tools/scalafix { scalafix = callPackage ../development/tools/scalafix {
jre = jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731 jre = jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
jdk = jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
}; };
scalafmt = callPackage ../development/tools/scalafmt { }; scalafmt = callPackage ../development/tools/scalafmt { };