nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 php,
6 versionCheckHook,
7 makeBinaryWrapper,
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 pname = "phpstan";
12 version = "2.1.37";
13
14 src = fetchFromGitHub {
15 owner = "phpstan";
16 repo = "phpstan";
17 tag = finalAttrs.version;
18 hash = "sha256-Ov4wCIKHuVtVKCTLBR9d2W2yNw49U2gGZkygEPhXTRA=";
19 };
20
21 nativeBuildInputs = [
22 makeBinaryWrapper
23 ];
24
25 postInstall = ''
26 install -D ./phpstan.phar $out/libexec/phpstan/phpstan.phar
27 makeWrapper ${lib.getExe php} $out/bin/phpstan \
28 --add-flags "$out/libexec/phpstan/phpstan.phar" \
29 --prefix PATH : ${
30 lib.makeBinPath [
31 php
32 ]
33 }
34 '';
35
36 doInstallCheck = true;
37 nativeInstallCheckInputs = [ versionCheckHook ];
38
39 meta = {
40 changelog = "https://github.com/phpstan/phpstan/releases/tag/${finalAttrs.version}";
41 description = "PHP Static Analysis Tool";
42 homepage = "https://github.com/phpstan/phpstan";
43 longDescription = ''
44 PHPStan focuses on finding errors in your code without actually
45 running it. It catches whole classes of bugs even before you write
46 tests for the code. It moves PHP closer to compiled languages in the
47 sense that the correctness of each line of the code can be checked
48 before you run the actual line.
49 '';
50 license = lib.licenses.mit;
51 mainProgram = "phpstan";
52 maintainers = with lib.maintainers; [
53 patka
54 piotrkwiecinski
55 ];
56 };
57})