Unverified Commit f0987a05 authored by Elis Hirwing's avatar Elis Hirwing
Browse files

php.packages.composer: Make sure that both composers use the same version

So in php we have a bootstrapping composer (that lives in
composer-phar.nix) that downloads the binary distribution of composer
to be able to bootstrap and build a composer built from source.

However, it's desirable to keep composer updated at all time, and this
includes the phar one that isn't used by users directly. So this makes
sure we don't "forget" about the phar one since it now borrows the
version from the source version. However, then it also made sense to
move the hash for the phar to the same file as the source
composer. Then we can control the full upgrade life cycle of both the
phar and source versions of composer from the same file.
parent 13441fc1
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
{ callPackage, stdenvNoCC, lib, fetchFromGitHub, makeBinaryWrapper }:
{ php, callPackage, stdenvNoCC, lib, fetchFromGitHub, makeBinaryWrapper }:

let
  composer = callPackage ./composer-phar.nix { };
  composer = callPackage ./composer-phar.nix {
    inherit (php.packages.composer) version pharHash;
  };

  composerKeys = stdenvNoCC.mkDerivation (finalComposerKeysAttrs: {
    pname = "composer-keys";
+4 −2
Original line number Diff line number Diff line
@@ -10,15 +10,17 @@
  , stdenvNoCC
  , unzip
  , xz
  , version
  , pharHash
}:

stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "composer-phar";
  version = "2.6.5";
  inherit version;

  src = fetchurl {
    url = "https://github.com/composer/composer/releases/download/${finalAttrs.version}/composer.phar";
    hash = "sha256-mhjho6rby5TBuv1sSpj/kx9LQ6RW70hXUTBGbhnwXdY=";
    hash = pharHash;
  };

  dontUnpack = true;
+10 −1
Original line number Diff line number Diff line
{ lib, callPackage, fetchFromGitHub, php, unzip, _7zz, xz, git, curl, cacert, makeBinaryWrapper }:

php.buildComposerProject (finalAttrs: {
  composer = callPackage ../../../build-support/php/pkgs/composer-phar.nix { };
  # 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-mhjho6rby5TBuv1sSpj/kx9LQ6RW70hXUTBGbhnwXdY=";

  composer = callPackage ../../../build-support/php/pkgs/composer-phar.nix {
    inherit (finalAttrs) version;
    inherit (finalAttrs.passthru) pharHash;
  };

  pname = "composer";
  version = "2.6.5";