1{ mkDerivation, fetchFromGitHub, makeWrapper, lib, php, php81 }:
2let
3 pname = "php-parallel-lint";
4 version = "1.3.2";
5in
6mkDerivation {
7 inherit pname version;
8
9 src = fetchFromGitHub {
10 owner = "php-parallel-lint";
11 repo = "PHP-Parallel-Lint";
12 rev = "v${version}";
13 # `.gitattibutes` exclude `box.json` from the archive produced git.
14 forceFetchGit = true;
15 sha256 = "SPP1ynxJad2m5wknGt8z94fW7Ucx8nqLvwZVmlylOgM=";
16 };
17
18 nativeBuildInputs = [
19 makeWrapper
20 php.packages.composer
21 # box is only available for PHP ≥ 8.1 but the purpose of this tool is to validate
22 # that project does not use features not available on older PHP versions.
23 php81.packages.box
24 ];
25
26 buildPhase = ''
27 runHook preBuild
28 composer dump-autoload
29 box compile
30 runHook postBuild
31 '';
32
33 installPhase = ''
34 runHook preInstall
35 mkdir -p $out/bin
36 install -D parallel-lint.phar $out/libexec/php-parallel-lint/php-parallel-lint.phar
37 makeWrapper ${php}/bin/php $out/bin/php-parallel-lint \
38 --add-flags "$out/libexec/php-parallel-lint/php-parallel-lint.phar"
39 runHook postInstall
40 '';
41
42 meta = with lib; {
43 description = "Tool to check syntax of PHP files faster than serial check with fancier output";
44 license = licenses.bsd2;
45 homepage = "https://github.com/php-parallel-lint/PHP-Parallel-Lint";
46 maintainers = with maintainers; [ ] ++ teams.php.members;
47 };
48}