Commit 624495f5 authored by Pol Dellaiera's avatar Pol Dellaiera
Browse files

phpPackages.psalm: use `buildComposerProject` builder

parent dfa9e40a
Loading
Loading
Loading
Loading
+4636 −0

File added.

Preview size limit exceeded, changes collapsed.

+15 −25
Original line number Diff line number Diff line
{ mkDerivation, fetchurl, makeWrapper, lib, php }:
{ lib, fetchgit, php }:

let
php.buildComposerProject (finalAttrs: {
  pname = "psalm";
  version = "5.15.0";
in
mkDerivation {
  inherit pname version;

  src = fetchurl {
    url = "https://github.com/vimeo/psalm/releases/download/${version}/psalm.phar";
    sha256 = "sha256-eAvogKsnvXMNUZHh44RPHpd0iMqEY9fzqJvXPT7SE1A=";
  src = fetchgit {
    url = "https://github.com/vimeo/psalm.git";
    rev = finalAttrs.version;
    hash = "sha256-rRExT82+IwgVo7pL3rrTjW/qj/MJf4m4L3PywaeSHYU=";
  };

  dontUnpack = true;
  # TODO: Open a PR against https://github.com/vimeo/psalm
  # Missing `composer.lock` from the repository.
  composerLock = ./composer.lock;
  vendorHash = "sha256-Vho1ri/Qm2SYeXB9ZoXvH1vB/eSBwHnAT/pI4jjUYhU=";

  nativeBuildInputs = [ makeWrapper ];

  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    install -D $src $out/libexec/psalm/psalm.phar
    makeWrapper ${php}/bin/php $out/bin/psalm \
      --add-flags "$out/libexec/psalm/psalm.phar"
    runHook postInstall
  '';

  meta = with lib; {
    changelog = "https://github.com/vimeo/psalm/releases/tag/${version}";
  meta = {
    changelog = "https://github.com/vimeo/psalm/releases/tag/${finalAttrs.version}";
    description = "A static analysis tool for finding errors in PHP applications";
    license = licenses.mit;
    homepage = "https://github.com/vimeo/psalm";
    maintainers = teams.php.members;
    license = lib.licenses.mit;
    maintainers = lib.teams.php.members;
  };
}
})