Files
nixpkgs/pkgs/development/php-packages/composer/default.nix
T

69 lines
1.7 KiB
Nix

{
lib,
fetchFromGitHub,
callPackage,
php,
makeBinaryWrapper,
_7zz,
curl,
gitMinimal,
unzip,
xz,
versionCheckHook,
}:
php.buildComposerProject2 (finalAttrs: {
pname = "composer";
version = "2.9.2";
src = fetchFromGitHub {
owner = "composer";
repo = "composer";
tag = finalAttrs.version;
hash = "sha256-Ke+QGcKPqm1wEVVYgUCL0K3nT+qmzWpRX6HcZnzdhgA=";
};
nativeBuildInputs = [
makeBinaryWrapper
];
# Bootstrapping Composer (source) with Composer (PHAR distribution).
# Override the default `composer` attribute to prevent infinite recursion.
composer = callPackage ../../../build-support/php/pkgs/composer-phar.nix {
inherit (finalAttrs) version;
inherit (finalAttrs.passthru) pharHash;
};
vendorHash = "sha256-cqELlLH7d5KR62uVn7VtpQhVjkhXZkclXfc5d8RAG5Y=";
postInstall = ''
wrapProgram $out/bin/composer \
--prefix PATH : ${
lib.makeBinPath [
_7zz
curl
gitMinimal
unzip
xz
]
}
'';
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
# Hash used by ../../../build-support/php/pkgs/composer-phar.nix to
# use together with the version from this package to keep the
# bootstrap phar file up-to-date together with the end user composer
# package.
passthru.pharHash = "sha256-Rx8thXq/DsGK97BV5hRyIU2RrbJPm9u7hkwcZPqtfdY=";
meta = {
changelog = "https://github.com/composer/composer/releases/tag/${finalAttrs.version}";
description = "Dependency Manager for PHP";
homepage = "https://getcomposer.org/";
license = lib.licenses.mit;
mainProgram = "composer";
teams = [ lib.teams.php ];
};
})