nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 callPackage,
5 php,
6 makeBinaryWrapper,
7 _7zz,
8 curl,
9 gitMinimal,
10 unzip,
11 xz,
12 versionCheckHook,
13}:
14php.buildComposerProject2 (finalAttrs: {
15 pname = "composer";
16 version = "2.9.5";
17
18 src = fetchFromGitHub {
19 owner = "composer";
20 repo = "composer";
21 tag = finalAttrs.version;
22 hash = "sha256-e9z0H6Bw3yIaLjgEbspgi6skIpUJs1s0KNkcgFqoy34=";
23 };
24
25 nativeBuildInputs = [
26 makeBinaryWrapper
27 ];
28
29 # Bootstrapping Composer (source) with Composer (PHAR distribution).
30 # Override the default `composer` attribute to prevent infinite recursion.
31 composer = callPackage ../../../build-support/php/pkgs/composer-phar.nix {
32 inherit (finalAttrs) version;
33 inherit (finalAttrs.passthru) pharHash;
34 };
35
36 vendorHash = "sha256-Tqtpz/IV4PGOaye0doWZgY9u7SuvS94eH22wM2+myqU=";
37
38 postInstall = ''
39 wrapProgram $out/bin/composer \
40 --prefix PATH : ${
41 lib.makeBinPath [
42 _7zz
43 curl
44 gitMinimal
45 unzip
46 xz
47 ]
48 }
49 '';
50
51 doInstallCheck = true;
52 nativeInstallCheckInputs = [ versionCheckHook ];
53
54 # Hash used by ../../../build-support/php/pkgs/composer-phar.nix to
55 # use together with the version from this package to keep the
56 # bootstrap phar file up-to-date together with the end user composer
57 # package.
58 passthru.pharHash = "sha256-Oz+VA6LUZZAXDkXt0pc0GX55fOpUWzltCygjysjvRkM=";
59
60 meta = {
61 changelog = "https://github.com/composer/composer/releases/tag/${finalAttrs.version}";
62 description = "Dependency Manager for PHP";
63 homepage = "https://getcomposer.org/";
64 license = lib.licenses.mit;
65 mainProgram = "composer";
66 teams = [ lib.teams.php ];
67 };
68})