1{ lib
2, php
3, mkDerivation
4, fetchurl
5, makeWrapper
6}:
7let
8 php' = php.withExtensions ({ enabled, all }: enabled ++ [ all.ast ]);
9in
10mkDerivation rec {
11 pname = "phan";
12 version = "5.4.1";
13
14 src = fetchurl {
15 url = "https://github.com/phan/phan/releases/download/${version}/phan.phar";
16 hash = "sha256-DJr1BWAfNI3hYvmBui5Dp+n7ec+f+gkOso21KEd6m8I=";
17 };
18
19 dontUnpack = true;
20
21 nativeBuildInputs = [ makeWrapper ];
22
23 installPhase = ''
24 runHook preInstall
25 mkdir -p $out/bin
26 install -D $src $out/libexec/phan/phan.phar
27 makeWrapper ${php'}/bin/php $out/bin/phan \
28 --add-flags "$out/libexec/phan/phan.phar"
29 runHook postInstall
30 '';
31
32 meta = with lib; {
33 description = "Static analyzer for PHP";
34 longDescription = ''
35 Phan is a static analyzer for PHP. Phan prefers to avoid false-positives
36 and attempts to prove incorrectness rather than correctness.
37 '';
38 license = licenses.mit;
39 homepage = "https://github.com/phan/phan";
40 maintainers = [ maintainers.apeschar ];
41 };
42}