Unverified Commit 42be235e authored by Pol Dellaiera's avatar Pol Dellaiera
Browse files

n98-magerun: use `buildComposerProject` builder

parent ee4ecc33
Loading
Loading
Loading
Loading
+11 −30
Original line number Diff line number Diff line
{
  stdenv
, fetchurl
, makeBinaryWrapper
, php
, lib
, unzip
{ lib
, fetchFromGitHub
, php81
}:

stdenv.mkDerivation (finalAttrs: {
php81.buildComposerProject (finalAttrs: {
  pname = "n98-magerun";
  version = "2.3.0";

  src = fetchurl {
    url = "https://github.com/netz98/n98-magerun/releases/download/${finalAttrs.version}/n98-magerun.phar";
    hash = "sha256-s+Cdr8zU3VBaBzxOh4nXjqPe+JPPxHWiFOEVS/86qOQ=";
  src = fetchFromGitHub {
    owner = "netz98";
    repo = "n98-magerun";
    rev = finalAttrs.version;
    hash = "sha256-/RffdYgl2cs8mlq4vHtzUZ6j0viV8Ot/cB/cB1dstFM=";
  };

  dontUnpack = true;

  nativeBuildInputs = [
    makeBinaryWrapper
  ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin $out/libexec/n98-magerun

    install -D $src $out/libexec/n98-magerun/n98-magerun.phar
    makeWrapper ${php}/bin/php $out/bin/n98-magerun \
      --add-flags "$out/libexec/n98-magerun/n98-magerun.phar" \
      --prefix PATH : ${lib.makeBinPath [ unzip ]}

    runHook postInstall
  '';
  vendorHash = "sha256-n608AY6AQdVuN3hfVQk02vJQ6hl/0+4LVBOsBL5o3+8=";

  meta = {
    broken = true; # Not compatible with PHP 8.1, see https://github.com/netz98/n98-magerun/issues/1275
    changelog = "https://magerun.net/category/magerun/";
    description = "The swiss army knife for Magento1/OpenMage developers";
    homepage = "https://magerun.net/";
    license = lib.licenses.mit;
    mainProgram = "n98-magerun";
    maintainers = lib.teams.php.members;
  };
})