phpPackages.phpmd: use buildComposerProject builder

This commit is contained in:
Pol Dellaiera 2024-02-20 12:35:27 +01:00
parent 6886619435
commit ee4ecc331b
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA
2 changed files with 1255 additions and 25 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,35 +1,30 @@
{ mkDerivation, fetchurl, makeWrapper, lib, php }:
{ lib
, fetchFromGitHub
, php
}:
let
php.buildComposerProject (finalAttrs: {
pname = "phpmd";
version = "2.15.0";
in
mkDerivation {
inherit pname version;
src = fetchurl {
url = "https://github.com/phpmd/phpmd/releases/download/${version}/phpmd.phar";
sha256 = "sha256-aijvVd4MdTsHDR0VgLsIoNFGAW+J8O3c72CsT8EINUQ=";
src = fetchFromGitHub {
owner = "phpmd";
repo = "phpmd";
rev = finalAttrs.version;
hash = "sha256-nTuJGzOZnkqrfE9R9Vujz/zGJRLlj8+yRZmmnxWrieQ=";
};
dontUnpack = true;
# Missing `composer.lock` from the repository.
# Issue open at https://github.com/phpmd/phpmd/issues/1056
composerLock = ./composer.lock;
vendorHash = "sha256-vr0wQkfhXHLEz8Q5nEq5Bocu1U1nDhXUlaHBsysvuRQ=";
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install -D $src $out/libexec/phpmd/phpmd.phar
makeWrapper ${php}/bin/php $out/bin/phpmd \
--add-flags "$out/libexec/phpmd/phpmd.phar"
runHook postInstall
'';
meta = with lib; {
changelog = "https://github.com/phpmd/phpmd/releases/tag/${version}";
meta = {
changelog = "https://github.com/phpmd/phpmd/releases/tag/${finalAttrs.version}";
description = "PHP code quality analyzer";
license = licenses.bsd3;
homepage = "https://phpmd.org/";
maintainers = teams.php.members;
license = lib.licenses.bsd3;
mainProgram = "phpmd";
maintainers = lib.teams.php.members;
};
}
})