From a1e85db798ac1078a2e71925b41ca5b4d4776bfc Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Thu, 5 Oct 2023 22:42:30 +0200 Subject: [PATCH] phpPackages.phpstan: use `buildComposerProject` builder --- .../php-packages/phpstan/default.nix | 38 +++++++------------ 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/pkgs/development/php-packages/phpstan/default.nix b/pkgs/development/php-packages/phpstan/default.nix index 736e4f5bf810..63b223b888c1 100644 --- a/pkgs/development/php-packages/phpstan/default.nix +++ b/pkgs/development/php-packages/phpstan/default.nix @@ -1,32 +1,20 @@ -{ mkDerivation, fetchurl, makeWrapper, lib, php }: +{ fetchFromGitHub, lib, php }: -let +php.buildComposerProject (finalAttrs: { pname = "phpstan"; version = "1.10.37"; -in -mkDerivation { - inherit pname version; - src = fetchurl { - url = "https://github.com/phpstan/phpstan/releases/download/${version}/phpstan.phar"; - sha256 = "sha256-i1h3N11MsKhHx/RJxAthnUbjacA5yZJF6bzmQnmEKzg="; + src = fetchFromGitHub { + owner = "phpstan"; + repo = "phpstan-src"; + rev = finalAttrs.version; + hash = "sha256-y55bfwE3H/oDCwDq3wrClyX8dhk0p6vEl/CMhqN6LkA="; }; - dontUnpack = true; + vendorHash = "sha256-hjCfrmpn2rYgApenZkHX8fXqPXukh7BVKENkvwIk8Dk="; - nativeBuildInputs = [ makeWrapper ]; - - installPhase = '' - runHook preInstall - mkdir -p $out/bin - install -D $src $out/libexec/phpstan/phpstan.phar - makeWrapper ${php}/bin/php $out/bin/phpstan \ - --add-flags "$out/libexec/phpstan/phpstan.phar" - runHook postInstall - ''; - - meta = with lib; { - changelog = "https://github.com/phpstan/phpstan/releases/tag/${version}"; + meta = { + changelog = "https://github.com/phpstan/phpstan/releases/tag/${finalAttrs.version}"; description = "PHP Static Analysis Tool"; longDescription = '' PHPStan focuses on finding errors in your code without actually @@ -35,8 +23,8 @@ mkDerivation { sense that the correctness of each line of the code can be checked before you run the actual line. ''; - license = licenses.mit; + license = lib.licenses.mit; homepage = "https://github.com/phpstan/phpstan"; - maintainers = teams.php.members; + maintainers = lib.teams.php.members; }; -} +})