nixpkgs/pkgs/build-support/php/build-composer-project.nix

63 lines
1.7 KiB
Nix

{ callPackage, stdenvNoCC, lib, writeTextDir, php, makeBinaryWrapper, fetchFromGitHub, fetchurl }:
let
buildComposerProjectOverride = finalAttrs: previousAttrs:
let
phpDrv = finalAttrs.php or php;
composer = finalAttrs.composer or phpDrv.packages.composer;
composer-local-repo-plugin = callPackage ./composer-local-repo-plugin.nix { };
composerLock = finalAttrs.composerLock or null;
in
{
nativeBuildInputs = (previousAttrs.nativeBuildInputs or [ ]) ++ [
composer
composer-local-repo-plugin
phpDrv.composerHooks.composerInstallHook
];
buildInputs = (previousAttrs.buildInputs or [ ]) ++ [
phpDrv
];
patches = previousAttrs.patches or [ ];
strictDeps = previousAttrs.strictDeps or true;
# Should we keep these empty phases?
configurePhase = previousAttrs.configurePhase or ''
runHook preConfigure
runHook postConfigure
'';
buildPhase = previousAttrs.buildPhase or ''
runHook preBuild
runHook postBuild
'';
doCheck = previousAttrs.doCheck or true;
checkPhase = previousAttrs.checkPhase or ''
runHook preCheck
runHook postCheck
'';
installPhase = previousAttrs.installPhase or ''
runHook preInstall
runHook postInstall
'';
composerRepository = phpDrv.mkComposerRepository {
inherit composer composer-local-repo-plugin composerLock;
inherit (finalAttrs) patches pname src vendorHash version;
};
meta = previousAttrs.meta or { } // {
platforms = lib.platforms.all;
};
};
in
args: (stdenvNoCC.mkDerivation args).overrideAttrs buildComposerProjectOverride