about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPol Dellaiera <pol.dellaiera@protonmail.com>2024-02-20 12:20:31 +0100
committerPol Dellaiera <pol.dellaiera@protonmail.com>2024-02-25 17:35:07 +0100
commitd653d7800fef3b6b43aa695bdb7382eebb9990d2 (patch)
tree1dbce37bc99dab889cdd52ee3372c7248662a69a
parent7491aa43a777881766e02f32c0e42b263d0a2469 (diff)
phpPackages.phan: use `buildComposerProject` builder
-rw-r--r--pkgs/development/php-packages/phan/default.nix42
1 files changed, 15 insertions, 27 deletions
diff --git a/pkgs/development/php-packages/phan/default.nix b/pkgs/development/php-packages/phan/default.nix
index 82beda4ad00b7..e390389eef227 100644
--- a/pkgs/development/php-packages/phan/default.nix
+++ b/pkgs/development/php-packages/phan/default.nix
@@ -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;
-
-  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
-  '';
+  vendorHash = "sha256-yE85MBseJa0VGV5EbjT0te4QT3697YvtumGkMMfZtxI=";
 
-  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;
   };
-}
+})