1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00
nixpkgs/pkgs/development/tools/scalafix/default.nix
Sergei Trofimovich af938ef5d6 scalafix.tests: fix eval
Without the change `tests` eval fails as:

    $ nix build --no-link -f. scalafix.tests
    error:
       … from call site
         at pkgs/development/tools/scalafix/default.nix:42:21:
           41|     passthru.tests = {
           42|       testVersion = testers.testVersion {
             |                     ^
           43|         program = "${finalAttrs.pname}";

       error: function 'testVersion' called without required argument 'package'
       at pkgs/build-support/testers/default.nix:59:5:
           58|   testVersion =
           59|     { package,
             |     ^
           60|       command ? "${package.meta.mainProgram or package.pname or package.name} --version",
2024-04-22 07:56:30 +01:00

58 lines
1.6 KiB
Nix

{
lib,
stdenv,
jre,
coursier,
makeWrapper,
installShellFiles,
setJavaClassPath,
testers,
}:
stdenv.mkDerivation (
finalAttrs: {
pname = "scalafix";
version = "0.12.0";
deps = stdenv.mkDerivation {
name = "${finalAttrs.pname}-deps-${finalAttrs.version}";
buildCommand = ''
export COURSIER_CACHE=$(pwd)
${coursier}/bin/cs fetch ch.epfl.scala:scalafix-cli_2.13.13:${finalAttrs.version} > deps
mkdir -p $out/share/java
cp $(< deps) $out/share/java/
'';
outputHashMode = "recursive";
outputHash = "sha256-HMTnr3awTIAgLSl4eF36U1kv162ajJxC5MreSk2TfUE=";
};
nativeBuildInputs = [makeWrapper installShellFiles setJavaClassPath];
buildInputs = [finalAttrs.deps];
dontUnpack = true;
installPhase = ''
makeWrapper ${jre}/bin/java $out/bin/${finalAttrs.pname} \
--add-flags "-cp $CLASSPATH scalafix.cli.Cli"
installShellCompletion --cmd ${finalAttrs.pname} \
--bash <($out/bin/${finalAttrs.pname} --bash) \
--zsh <($out/bin/${finalAttrs.pname} --zsh)
'';
passthru.tests = {
testVersion = testers.testVersion {
package = finalAttrs.finalPackage;
version = "${finalAttrs.version}";
};
};
meta = with lib; {
description = "Refactoring and linting tool for Scala";
mainProgram = "scalafix";
homepage = "https://scalacenter.github.io/scalafix/";
license = licenses.bsd3;
maintainers = [maintainers.tomahna];
sourceProvenance = with sourceTypes; [ binaryBytecode ];
};
}
)