phpPackages.phpstan: use buildComposerProject builder

This commit is contained in:
Pol Dellaiera 2023-10-05 22:42:30 +02:00
parent 043a094c3b
commit a1e85db798

View File

@ -1,32 +1,20 @@
{ mkDerivation, fetchurl, makeWrapper, lib, php }:
{ fetchFromGitHub, lib, php }:
let
php.buildComposerProject (finalAttrs: {
pname = "phpstan";
version = "1.10.37";
in
mkDerivation {
inherit pname version;
src = fetchurl {
url = "https://github.com/phpstan/phpstan/releases/download/${version}/phpstan.phar";
sha256 = "sha256-i1h3N11MsKhHx/RJxAthnUbjacA5yZJF6bzmQnmEKzg=";
src = fetchFromGitHub {
owner = "phpstan";
repo = "phpstan-src";
rev = finalAttrs.version;
hash = "sha256-y55bfwE3H/oDCwDq3wrClyX8dhk0p6vEl/CMhqN6LkA=";
};
dontUnpack = true;
vendorHash = "sha256-hjCfrmpn2rYgApenZkHX8fXqPXukh7BVKENkvwIk8Dk=";
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install -D $src $out/libexec/phpstan/phpstan.phar
makeWrapper ${php}/bin/php $out/bin/phpstan \
--add-flags "$out/libexec/phpstan/phpstan.phar"
runHook postInstall
'';
meta = with lib; {
changelog = "https://github.com/phpstan/phpstan/releases/tag/${version}";
meta = {
changelog = "https://github.com/phpstan/phpstan/releases/tag/${finalAttrs.version}";
description = "PHP Static Analysis Tool";
longDescription = ''
PHPStan focuses on finding errors in your code without actually
@ -35,8 +23,8 @@ mkDerivation {
sense that the correctness of each line of the code can be checked
before you run the actual line.
'';
license = licenses.mit;
license = lib.licenses.mit;
homepage = "https://github.com/phpstan/phpstan";
maintainers = teams.php.members;
maintainers = lib.teams.php.members;
};
}
})