Merge pull request #248184 from NixOS/php/add-new-builder-only

php: add new Composer builder
This commit is contained in:
Elis Hirwing 2023-09-14 07:50:27 +02:00 committed by GitHub
commit 350cac13cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 686 additions and 22 deletions

3
.github/CODEOWNERS vendored
View File

@ -257,7 +257,8 @@ pkgs/development/python-modules/buildcatrust/ @ajs124 @lukegb @mweinelt
# PHP interpreter, packages, extensions, tests and documentation
/doc/languages-frameworks/php.section.md @aanderse @drupol @etu @globin @ma27 @talyz
/nixos/tests/php @aanderse @drupol @etu @globin @ma27 @talyz
/pkgs/build-support/build-pecl.nix @aanderse @drupol @etu @globin @ma27 @talyz
/pkgs/build-support/php/build-pecl.nix @aanderse @drupol @etu @globin @ma27 @talyz
/pkgs/build-support/php @drupol @etu
/pkgs/development/interpreters/php @jtojnar @aanderse @drupol @etu @globin @ma27 @talyz
/pkgs/development/php-packages @aanderse @drupol @etu @globin @ma27 @talyz
/pkgs/top-level/php-packages.nix @jtojnar @aanderse @drupol @etu @globin @ma27 @talyz

View File

@ -130,6 +130,7 @@ package: a project may depend on certain extensions and `composer`
won't work with that project unless those extensions are loaded.
Example of building `composer` with additional extensions:
```nix
(php.withExtensions ({ all, enabled }:
enabled ++ (with all; [ imagick redis ]))
@ -138,7 +139,9 @@ Example of building `composer` with additional extensions:
### Overriding PHP packages {#ssec-php-user-guide-overriding-packages}
`php-packages.nix` form a scope, allowing us to override the packages defined within. For example, to apply a patch to a `mysqlnd` extension, you can simply pass an overlay-style function to `php`s `packageOverrides` argument:
`php-packages.nix` form a scope, allowing us to override the packages defined
within. For example, to apply a patch to a `mysqlnd` extension, you can simply
pass an overlay-style function to `php`s `packageOverrides` argument:
```nix
php.override {
@ -153,3 +156,138 @@ php.override {
};
}
```
### Building PHP projects {#ssec-building-php-projects}
With [Composer](https://getcomposer.org/), you can effectively build PHP
projects by streamlining dependency management. As the de-facto standard
dependency manager for PHP, Composer enables you to declare and manage the
libraries your project relies on, ensuring a more organized and efficient
development process.
Composer is not a package manager in the same sense as `Yum` or `Apt` are. Yes,
it deals with "packages" or libraries, but it manages them on a per-project
basis, installing them in a directory (e.g. `vendor`) inside your project. By
default, it does not install anything globally. This idea is not new and
Composer is strongly inspired by node's `npm` and ruby's `bundler`.
Currently, there is no other PHP tool that offers the same functionality as
Composer. Consequently, incorporating a helper in Nix to facilitate building
such applications is a logical choice.
In a Composer project, dependencies are defined in a `composer.json` file,
while their specific versions are locked in a `composer.lock` file. Some
Composer-based projects opt to include this `composer.lock` file in their source
code, while others choose not to.
In Nix, there are multiple approaches to building a Composer-based project.
One such method is the `php.buildComposerProject` helper function, which serves
as a wrapper around `mkDerivation`.
Using this function, you can build a PHP project that includes both a
`composer.json` and `composer.lock` file. If the project specifies binaries
using the `bin` attribute in `composer.json`, these binaries will be
automatically linked and made accessible in the derivation. In this context,
"binaries" refer to PHP scripts that are intended to be executable.
To use the helper effectively, simply add the `vendorHash` attribute, which
enables the wrapper to handle the heavy lifting.
Internally, the helper operates in three stages:
1. It constructs a `composerRepository` attribute derivation by creating a
composer repository on the filesystem containing dependencies specified in
`composer.json`. This process uses the function
`php.mkComposerRepository` which in turn uses the
`php.composerHooks.composerRepositoryHook` hook. Internaly this function uses
a custom
[Composer plugin](https://github.com/nix-community/composer-local-repo-plugin) to
generate the repository.
2. The resulting `composerRepository` derivation is then used by the
`php.composerHooks.composerInstallHook` hook, which is responsible for
creating the final `vendor` directory.
3. Any "binary" specified in the `composer.json` are linked and made accessible
in the derivation.
As the autoloader optimization can be activated directly within the
`composer.json` file, we do not enable any autoloader optimization flags.
To customize the PHP version, you can specify the `php` attribute. Similarly, if
you wish to modify the Composer version, use the `composer` attribute. It is
important to note that both attributes should be of the `derivation` type.
Here's an example of working code example using `php.buildComposerProject`:
```nix
{ php, fetchFromGitHub }:
php.buildComposerProject (finalAttrs: {
pname = "php-app";
version = "1.0.0";
src = fetchFromGitHub {
owner = "git-owner";
repo = "git-repo";
rev = finalAttrs.version;
hash = "sha256-VcQRSss2dssfkJ+iUb5qT+FJ10GHiFDzySigcmuVI+8=";
};
# PHP version containing the `ast` extension enabled
php = php.buildEnv {
extensions = ({ enabled, all }: enabled ++ (with all; [
ast
]));
};
# The composer vendor hash
vendorHash = "sha256-86s/F+/5cBAwBqZ2yaGRM5rTGLmou5//aLRK5SA0WiQ=";
# If the composer.lock file is missing from the repository, add it:
# composerLock = ./path/to/composer.lock;
})
```
In case the file `composer.lock` is missing from the repository, it is possible
to specify it using the `composerLock` attribute.
The other method is to use all these methods and hooks individually. This has
the advantage of building a PHP library within another derivation very easily
when necessary.
Here's a working code example to build a PHP library using `mkDerivation` and
separate functions and hooks:
```nix
{ stdenvNoCC, fetchFromGitHub, php }:
stdenvNoCC.mkDerivation (finalAttrs:
let
src = fetchFromGitHub {
owner = "git-owner";
repo = "git-repo";
rev = finalAttrs.version;
hash = "sha256-VcQRSss2dssfkJ+iUb5qT+FJ10GHiFDzySigcmuVI+8=";
};
in {
inherit src;
pname = "php-app";
version = "1.0.0";
buildInputs = [ php ];
nativeBuildInputs = [
php.packages.composer
# This hook will use the attribute `composerRepository`
php.composerHooks.composerInstallHook
];
composerRepository = php.mkComposerRepository {
inherit (finalAttrs) src;
# Specifying a custom composer.lock since it is not present in the sources.
composerLock = ./composer.lock;
# The composer vendor hash
vendorHash = "sha256-86s/F+/5cBAwBqZ2yaGRM5rTGLmou5//aLRK5SA0WiQ=";
};
})
```

View File

@ -0,0 +1,71 @@
{ 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 ./pkgs/composer-local-repo-plugin.nix { };
in
{
composerLock = previousAttrs.composerLock or null;
composerNoDev = previousAttrs.composerNoDev or true;
composerNoPlugins = previousAttrs.composerNoPlugins or true;
composerNoScripts = previousAttrs.composerNoScripts or true;
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;
inherit (finalAttrs) patches pname src vendorHash version;
composerLock = previousAttrs.composerLock or null;
composerNoDev = previousAttrs.composerNoDev or true;
composerNoPlugins = previousAttrs.composerNoPlugins or true;
composerNoScripts = previousAttrs.composerNoScripts or true;
};
meta = previousAttrs.meta or { } // {
platforms = lib.platforms.all;
};
};
in
args: (stdenvNoCC.mkDerivation args).overrideAttrs buildComposerProjectOverride

View File

@ -0,0 +1,87 @@
{ callPackage, stdenvNoCC, lib, writeTextDir, fetchFromGitHub, php }:
let
mkComposerRepositoryOverride =
/*
We cannot destruct finalAttrs since the attrset below is used to construct it
and Nix currently does not support lazy attribute names.
{
php ? null,
composer ? null,
composerLock ? "composer.lock",
src,
vendorHash,
...
}@finalAttrs:
*/
finalAttrs: previousAttrs:
let
phpDrv = finalAttrs.php or php;
composer = finalAttrs.composer or phpDrv.packages.composer;
composer-local-repo-plugin = callPackage ./pkgs/composer-local-repo-plugin.nix { };
in
assert (lib.assertMsg (previousAttrs ? src) "mkComposerRepository expects src argument.");
assert (lib.assertMsg (previousAttrs ? vendorHash) "mkComposerRepository expects vendorHash argument.");
assert (lib.assertMsg (previousAttrs ? version) "mkComposerRepository expects version argument.");
assert (lib.assertMsg (previousAttrs ? pname) "mkComposerRepository expects pname argument.");
assert (lib.assertMsg (previousAttrs ? composerNoDev) "mkComposerRepository expects composerNoDev argument.");
assert (lib.assertMsg (previousAttrs ? composerNoPlugins) "mkComposerRepository expects composerNoPlugins argument.");
assert (lib.assertMsg (previousAttrs ? composerNoScripts) "mkComposerRepository expects composerNoScripts argument.");
{
composerNoDev = previousAttrs.composerNoDev or true;
composerNoPlugins = previousAttrs.composerNoPlugins or true;
composerNoScripts = previousAttrs.composerNoScripts or true;
name = "${previousAttrs.pname}-${previousAttrs.version}-composer-repository";
# See https://github.com/NixOS/nix/issues/6660
dontPatchShebangs = previousAttrs.dontPatchShebangs or true;
nativeBuildInputs = (previousAttrs.nativeBuildInputs or [ ]) ++ [
composer
composer-local-repo-plugin
phpDrv.composerHooks.composerRepositoryHook
];
buildInputs = previousAttrs.buildInputs 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
'';
COMPOSER_CACHE_DIR = "/dev/null";
COMPOSER_MIRROR_PATH_REPOS = "1";
COMPOSER_HTACCESS_PROTECT = "0";
COMPOSER_DISABLE_NETWORK = "0";
outputHashMode = "recursive";
outputHashAlgo = if (finalAttrs ? vendorHash && finalAttrs.vendorHash != "") then null else "sha256";
outputHash = finalAttrs.vendorHash or "";
};
in
args: (stdenvNoCC.mkDerivation args).overrideAttrs mkComposerRepositoryOverride

View File

@ -0,0 +1,113 @@
declare composerRepository
declare version
declare composerNoDev
declare composerNoPlugins
declare composerNoScripts
preConfigureHooks+=(composerInstallConfigureHook)
preBuildHooks+=(composerInstallBuildHook)
preCheckHooks+=(composerInstallCheckHook)
preInstallHooks+=(composerInstallInstallHook)
composerInstallConfigureHook() {
echo "Executing composerInstallConfigureHook"
if [[ ! -e "${composerRepository}" ]]; then
echo "No local composer repository found."
exit 1
fi
if [[ -e "$composerLock" ]]; then
cp "$composerLock" composer.lock
fi
if [[ ! -f "composer.lock" ]]; then
echo "No composer.lock file found, consider adding one to your repository to ensure reproducible builds."
if [[ -f "${composerRepository}/composer.lock" ]]; then
cp ${composerRepository}/composer.lock composer.lock
fi
echo "Using an autogenerated composer.lock file."
fi
chmod +w composer.json composer.lock
echo "Finished composerInstallConfigureHook"
}
composerInstallBuildHook() {
echo "Executing composerInstallBuildHook"
# Since this file cannot be generated in the composer-repository-hook.sh
# because the file contains hardcoded nix store paths, we generate it here.
composer-local-repo-plugin --no-ansi build-local-repo -p "${composerRepository}" > packages.json
# Remove all the repositories of type "composer"
# from the composer.json file.
jq -r -c 'del(try .repositories[] | select(.type == "composer"))' composer.json | sponge composer.json
# Configure composer to disable packagist and avoid using the network.
composer config repo.packagist false
# Configure composer to use the local repository.
composer config repo.composer composer file://"$PWD"/packages.json
# Since the composer.json file has been modified in the previous step, the
# composer.lock file needs to be updated.
COMPOSER_DISABLE_NETWORK=1 \
COMPOSER_ROOT_VERSION="${version}" \
composer \
--lock \
--no-ansi \
--no-install \
--no-interaction \
${composerNoDev:+--no-dev} \
${composerNoPlugins:+--no-plugins} \
${composerNoScripts:+--no-scripts} \
update
echo "Finished composerInstallBuildHook"
}
composerInstallCheckHook() {
echo "Executing composerInstallCheckHook"
composer validate --no-ansi --no-interaction
echo "Finished composerInstallCheckHook"
}
composerInstallInstallHook() {
echo "Executing composerInstallInstallHook"
# Finally, run `composer install` to install the dependencies and generate
# the autoloader.
# The COMPOSER_ROOT_VERSION environment variable is needed only for
# vimeo/psalm.
COMPOSER_CACHE_DIR=/dev/null \
COMPOSER_DISABLE_NETWORK=1 \
COMPOSER_ROOT_VERSION="${version}" \
COMPOSER_MIRROR_PATH_REPOS="1" \
composer \
--no-ansi \
--no-interaction \
${composerNoDev:+--no-dev} \
${composerNoPlugins:+--no-plugins} \
${composerNoScripts:+--no-scripts} \
install
# Remove packages.json, we don't need it in the store.
rm packages.json
# Copy the relevant files only in the store.
mkdir -p "$out"/share/php/"${pname}"
cp -r . "$out"/share/php/"${pname}"/
# Create symlinks for the binaries.
jq -r -c 'try .bin[]' composer.json | while read -r bin; do
mkdir -p "$out"/share/php/"${pname}" "$out"/bin
ln -s "$out"/share/php/"${pname}"/"$bin" "$out"/bin/"$(basename "$bin")"
done
echo "Finished composerInstallInstallHook"
}

View File

@ -0,0 +1,69 @@
declare composerLock
declare version
declare composerNoDev
declare composerNoPlugins
declare composerNoScripts
preConfigureHooks+=(composerRepositoryConfigureHook)
preBuildHooks+=(composerRepositoryBuildHook)
preCheckHooks+=(composerRepositoryCheckHook)
preInstallHooks+=(composerRepositoryInstallHook)
composerRepositoryConfigureHook() {
echo "Executing composerRepositoryConfigureHook"
if [[ -e "$composerLock" ]]; then
cp $composerLock composer.lock
fi
if [[ ! -f "composer.lock" ]]; then
echo "No composer.lock file found, consider adding one to your repository to ensure reproducible builds."
composer \
--no-ansi \
--no-install \
--no-interaction \
${composerNoDev:+--no-dev} \
${composerNoPlugins:+--no-plugins} \
${composerNoScripts:+--no-scripts} \
update
echo "Using an autogenerated composer.lock file."
fi
echo "Finished composerRepositoryConfigureHook"
}
composerRepositoryBuildHook() {
echo "Executing composerRepositoryBuildHook"
mkdir -p repository
# Build the local composer repository
# The command 'build-local-repo' is provided by the Composer plugin
# nix-community/composer-local-repo-plugin.
COMPOSER_CACHE_DIR=/dev/null \
composer-local-repo-plugin --no-ansi build-local-repo ${composerNoDev:+--no-dev} -r repository
echo "Finished composerRepositoryBuildHook"
}
composerRepositoryCheckHook() {
echo "Executing composerRepositoryCheckHook"
composer validate --no-ansi --no-interaction
echo "Finished composerRepositoryCheckHook"
}
composerRepositoryInstallHook() {
echo "Executing composerRepositoryInstallHook"
mkdir -p $out
cp -ar repository/. $out/
# Copy the composer.lock files to the output directory, in case it has been
# autogenerated.
cp composer.lock $out/
echo "Finished composerRepositoryInstallHook"
}

View File

@ -0,0 +1,21 @@
{ makeSetupHook
, php
, jq
, moreutils
}:
{
composerRepositoryHook = makeSetupHook
{
name = "composer-repository-hook.sh";
propagatedBuildInputs = [ php jq moreutils ];
substitutions = { };
} ./composer-repository-hook.sh;
composerInstallHook = makeSetupHook
{
name = "composer-install-hook.sh";
propagatedBuildInputs = [ php jq moreutils ];
substitutions = { };
} ./composer-install-hook.sh;
}

View File

@ -0,0 +1,112 @@
{ callPackage, stdenvNoCC, lib, fetchFromGitHub, makeBinaryWrapper }:
let
composer = callPackage ./composer-phar.nix { };
composerKeys = stdenvNoCC.mkDerivation (finalComposerKeysAttrs: {
pname = "composer-keys";
version = "fa5a62092f33e094073fbda23bbfc7188df3cbc5";
src = fetchFromGitHub {
owner = "composer";
repo = "composer.github.io";
rev = "${finalComposerKeysAttrs.version}";
hash = "sha256-3Sfn71LDG1jHwuEIU8iEnV3k6D6QTX7KVIKVaNSuCVE=";
};
installPhase = ''
runHook preInstall
mkdir -p $out
install releases.pub $out/keys.tags.pub
install snapshots.pub $out/keys.dev.pub
runHook postInstall
'';
});
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "composer-local-repo-plugin";
version = "1.0.0";
src = fetchFromGitHub {
owner = "nix-community";
repo = "composer-local-repo-plugin";
rev = finalAttrs.version;
hash = "sha256-sjWV4JXK8YJ5XLASMPipKlk9u57352wIDV2PPFIP+sk=";
};
COMPOSER_CACHE_DIR = "/dev/null";
COMPOSER_MIRROR_PATH_REPOS = "1";
COMPOSER_HTACCESS_PROTECT = "0";
COMPOSER_DISABLE_NETWORK = "1";
nativeBuildInputs = [
makeBinaryWrapper
];
buildInputs = [
composer
];
configurePhase = ''
runHook preConfigure
export COMPOSER_HOME=${placeholder "out"}
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
# Configure composer globally
composer global init --quiet --no-interaction --no-ansi \
--name="nixos/composer" \
--homepage "https://nixos.org/" \
--description "Composer with nix-community/composer-local-repo-plugin" \
--license "MIT"
composer global config --quiet minimum-stability dev
composer global config --quiet prefer-stable true
composer global config --quiet autoloader-suffix "nixPredictableAutoloaderSuffix"
composer global config --quiet apcu-autoloader false
composer global config --quiet allow-plugins.nix-community/composer-local-repo-plugin true
composer global config --quiet repo.packagist false
composer global config --quiet repo.plugin path $src
# Install the local repository plugin
composer global require --quiet --no-ansi --no-interaction nix-community/composer-local-repo-plugin
runHook postBuild
'';
checkPhase = ''
runHook preCheck
composer global validate --no-ansi
composer global show --no-ansi nix-community/composer-local-repo-plugin
runHook postCheck
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -ar ${composerKeys}/* $out/
makeWrapper ${composer}/bin/composer $out/bin/composer-local-repo-plugin \
--prefix COMPOSER_HOME : $out
runHook postInstall
'';
meta = {
description = "Composer local repo plugin for Composer";
homepage = "https://github.com/nix-community/composer-local-repo-plugin";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ drupol ];
platforms = lib.platforms.all;
};
})

View File

@ -0,0 +1,48 @@
{
_7zz
, cacert
, curl
, fetchurl
, git
, lib
, makeBinaryWrapper
, php
, stdenvNoCC
, unzip
, xz
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "composer-phar";
version = "2.6.2";
src = fetchurl {
url = "https://github.com/composer/composer/releases/download/${finalAttrs.version}/composer.phar";
hash = "sha256-iMhNSlP88cJ9Z2Lh1da3DVfG3J0uIxT9Cdv4a/YeGu8=";
};
dontUnpack = true;
nativeBuildInputs = [ makeBinaryWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install -D $src $out/libexec/composer/composer.phar
makeWrapper ${php}/bin/php $out/bin/composer \
--add-flags "$out/libexec/composer/composer.phar" \
--prefix PATH : ${lib.makeBinPath [ _7zz cacert curl git unzip xz ]}
runHook postInstall
'';
meta = {
changelog = "https://github.com/composer/composer/releases/tag/${finalAttrs.version}";
description = "Dependency Manager for PHP, shipped from the PHAR file";
homepage = "https://getcomposer.org/";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ drupol ];
platforms = lib.platforms.all;
};
})

View File

@ -159,7 +159,7 @@ let
nixos = lib.recurseIntoAttrs nixosTests."php${lib.strings.replaceStrings [ "." ] [ "" ] (lib.versions.majorMinor php.version)}";
package = tests.php;
};
inherit (php-packages) extensions buildPecl mkExtension;
inherit (php-packages) extensions buildPecl mkComposerRepository buildComposerProject composerHooks mkExtension;
packages = php-packages.tools;
meta = php.meta // {
outputsToInstall = [ "out" ];

View File

@ -1,33 +1,32 @@
{ mkDerivation, fetchurl, makeBinaryWrapper, unzip, lib, php }:
{ lib, callPackage, fetchFromGitHub, php, unzip, _7zz, xz, git, curl, cacert, makeBinaryWrapper }:
php.buildComposerProject (finalAttrs: {
composer = callPackage ../../../build-support/php/pkgs/composer-phar.nix { };
mkDerivation (finalAttrs: {
pname = "composer";
version = "2.6.2";
src = fetchurl {
url = "https://github.com/composer/composer/releases/download/${finalAttrs.version}/composer.phar";
hash = "sha256-iMhNSlP88cJ9Z2Lh1da3DVfG3J0uIxT9Cdv4a/YeGu8=";
src = fetchFromGitHub {
owner = "composer";
repo = "composer";
rev = finalAttrs.version;
hash = "sha256-tNc0hP41aRk7MmeWXCd73uHxK9pk1tCWyjiSO568qbE=";
};
dontUnpack = true;
nativeBuildInputs = [ makeBinaryWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install -D $src $out/libexec/composer/composer.phar
makeWrapper ${php}/bin/php $out/bin/composer \
--add-flags "$out/libexec/composer/composer.phar" \
--prefix PATH : ${lib.makeBinPath [ unzip ]}
runHook postInstall
postInstall = ''
wrapProgram $out/bin/composer \
--prefix PATH : ${lib.makeBinPath [ _7zz cacert curl git unzip xz ]}
'';
vendorHash = "sha256-V6C4LxEfXNWH/pCKATv1gf8f6/a0s/xu5j5bNJUNmnA=";
meta = {
changelog = "https://github.com/composer/composer/releases/tag/${finalAttrs.version}";
description = "Dependency Manager for PHP";
homepage = "https://getcomposer.org/";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ offline ] ++ lib.teams.php.members;
maintainers = lib.teams.php.members;
};
})

View File

@ -1,4 +1,6 @@
{ stdenv
, config
, callPackages
, lib
, pkgs
, phpPackage
@ -44,12 +46,15 @@
}:
lib.makeScope pkgs.newScope (self: with self; {
buildPecl = import ../build-support/build-pecl.nix {
buildPecl = callPackage ../build-support/php/build-pecl.nix {
php = php.unwrapped;
inherit lib;
inherit (pkgs) stdenv autoreconfHook fetchurl re2c nix-update-script;
};
composerHooks = callPackages ../build-support/php/hooks { };
mkComposerRepository = callPackage ../build-support/php/build-composer-repository.nix { };
buildComposerProject = callPackage ../build-support/php/build-composer-project.nix { };
# Wrap mkDerivation to prepend pname with "php-" to make names consistent
# with how buildPecl does it and make the file easier to overview.
mkDerivation = origArgs: