detekt: use finalAttrs.finalPackage

This commit is contained in:
Peder Bergebakken Sundt 2024-09-17 03:32:55 +02:00
parent 13cd33392a
commit fe7de85938

View File

@ -1,12 +1,12 @@
{ detekt, lib, stdenv, fetchurl, makeWrapper, jre_headless, testers }:
stdenv.mkDerivation rec {
{ lib, stdenv, fetchurl, makeWrapper, jre_headless, testers }:
stdenv.mkDerivation (finalAttrs: {
pname = "detekt";
version = "1.23.7";
jarfilename = "${pname}-${version}-executable.jar";
jarfilename = "detekt-${finalAttrs.version}-executable.jar";
src = fetchurl {
url = "https://github.com/detekt/detekt/releases/download/v${version}/detekt-cli-${version}-all.jar";
url = "https://github.com/detekt/detekt/releases/download/v${finalAttrs.version}/detekt-cli-${finalAttrs.version}-all.jar";
sha256 = "sha256-hL7e0oMBLLKzi8rvSZZFL81gadLpynS1Dqp54K0hiX4=";
};
@ -17,15 +17,15 @@ stdenv.mkDerivation rec {
installPhase = ''
runHook preInstall
install -D "$src" "$out/share/java/${jarfilename}"
install -D "$src" "$out/share/java/${finalAttrs.jarfilename}"
makeWrapper ${jre_headless}/bin/java $out/bin/detekt \
--add-flags "-jar $out/share/java/${jarfilename}"
--add-flags "-jar $out/share/java/${finalAttrs.jarfilename}"
runHook postInstall
'';
passthru.tests.version = testers.testVersion { package = detekt; };
passthru.tests.version = testers.testVersion { package = finalAttrs.finalPackage; };
meta = with lib; {
description = "Static code analysis for Kotlin";
@ -36,4 +36,4 @@ stdenv.mkDerivation rec {
maintainers = with maintainers; [ mdr ];
sourceProvenance = with sourceTypes; [ binaryBytecode ];
};
}
})