nixpkgs/pkgs/by-name/de/detekt/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

40 lines
1.1 KiB
Nix

{ lib, stdenv, fetchurl, makeWrapper, jre_headless, testers }:
stdenv.mkDerivation (finalAttrs: {
pname = "detekt";
version = "1.23.7";
jarfilename = "detekt-${finalAttrs.version}-executable.jar";
src = fetchurl {
url = "https://github.com/detekt/detekt/releases/download/v${finalAttrs.version}/detekt-cli-${finalAttrs.version}-all.jar";
sha256 = "sha256-hL7e0oMBLLKzi8rvSZZFL81gadLpynS1Dqp54K0hiX4=";
};
dontUnpack = true;
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
install -D "$src" "$out/share/java/${finalAttrs.jarfilename}"
makeWrapper ${jre_headless}/bin/java $out/bin/detekt \
--add-flags "-jar $out/share/java/${finalAttrs.jarfilename}"
runHook postInstall
'';
passthru.tests.version = testers.testVersion { package = finalAttrs.finalPackage; };
meta = with lib; {
description = "Static code analysis for Kotlin";
mainProgram = "detekt";
homepage = "https://detekt.dev/";
license = licenses.asl20;
platforms = jre_headless.meta.platforms;
maintainers = with maintainers; [ mdr ];
sourceProvenance = with sourceTypes; [ binaryBytecode ];
};
})