phpPackages.phan: use buildComposerProject builder

This commit is contained in:
Pol Dellaiera 2024-02-20 12:20:31 +01:00
parent 7491aa43a7
commit d653d7800f
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA

@ -1,42 +1,30 @@
{ lib
, fetchFromGitHub
, php
, mkDerivation
, fetchurl
, makeWrapper
}:
let
php' = php.withExtensions ({ enabled, all }: enabled ++ [ all.ast ]);
in
mkDerivation rec {
(php.withExtensions({ enabled, all }: enabled ++ (with all; [ ast ]))).buildComposerProject (finalAttrs: {
pname = "phan";
version = "5.4.3";
src = fetchurl {
url = "https://github.com/phan/phan/releases/download/${version}/phan.phar";
hash = "sha256-wZU6YIlH0q18iD044y6Z5gSscBn7cI0AwRwZgT/YhOo=";
src = fetchFromGitHub {
owner = "phan";
repo = "phan";
rev = finalAttrs.version;
hash = "sha256-O0dtnDsz6X99B99VbRQf3Wr/xJfsJqd+2l5Z5iWxHyU=";
};
dontUnpack = true;
vendorHash = "sha256-yE85MBseJa0VGV5EbjT0te4QT3697YvtumGkMMfZtxI=";
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install -D $src $out/libexec/phan/phan.phar
makeWrapper ${php'}/bin/php $out/bin/phan \
--add-flags "$out/libexec/phan/phan.phar"
runHook postInstall
'';
meta = with lib; {
meta = {
description = "Static analyzer for PHP";
homepage = "https://github.com/phan/phan";
license = lib.licenses.mit;
longDescription = ''
Phan is a static analyzer for PHP. Phan prefers to avoid false-positives
and attempts to prove incorrectness rather than correctness.
'';
license = licenses.mit;
homepage = "https://github.com/phan/phan";
maintainers = [ maintainers.apeschar ];
mainProgram = "phan";
maintainers = with lib.maintainers; [ apeschar ] ++ lib.teams.php.members;
};
}
})