diff --git a/pkgs/build-support/php/builders/default.nix b/pkgs/build-support/php/builders/default.nix new file mode 100644 index 000000000000..209c834367d1 --- /dev/null +++ b/pkgs/build-support/php/builders/default.nix @@ -0,0 +1,8 @@ +{ callPackage, callPackages, ... }: +{ + v1 = { + buildComposerProject = callPackage ./v1/build-composer-project.nix { }; + mkComposerRepository = callPackage ./v1/build-composer-repository.nix { }; + composerHooks = callPackages ./v1/hooks { }; + }; +} diff --git a/pkgs/build-support/php/build-composer-project.nix b/pkgs/build-support/php/builders/v1/build-composer-project.nix similarity index 96% rename from pkgs/build-support/php/build-composer-project.nix rename to pkgs/build-support/php/builders/v1/build-composer-project.nix index b83734a02f02..a29233593254 100644 --- a/pkgs/build-support/php/build-composer-project.nix +++ b/pkgs/build-support/php/builders/v1/build-composer-project.nix @@ -12,7 +12,7 @@ let let phpDrv = finalAttrs.php or php; composer = finalAttrs.composer or phpDrv.packages.composer; - composer-local-repo-plugin = callPackage ./pkgs/composer-local-repo-plugin.nix { }; + composer-local-repo-plugin = callPackage ../../pkgs/composer-local-repo-plugin.nix { }; in { composerLock = previousAttrs.composerLock or null; diff --git a/pkgs/build-support/php/build-composer-repository.nix b/pkgs/build-support/php/builders/v1/build-composer-repository.nix similarity index 97% rename from pkgs/build-support/php/build-composer-repository.nix rename to pkgs/build-support/php/builders/v1/build-composer-repository.nix index ec6c35b8a42c..54944b91d202 100644 --- a/pkgs/build-support/php/build-composer-repository.nix +++ b/pkgs/build-support/php/builders/v1/build-composer-repository.nix @@ -24,7 +24,7 @@ let let phpDrv = finalAttrs.php or php; composer = finalAttrs.composer or phpDrv.packages.composer; - composer-local-repo-plugin = callPackage ./pkgs/composer-local-repo-plugin.nix { }; + composer-local-repo-plugin = callPackage ../../pkgs/composer-local-repo-plugin.nix { }; in assert (lib.assertMsg (previousAttrs ? src) "mkComposerRepository expects src argument."); assert ( diff --git a/pkgs/build-support/php/hooks/composer-install-hook.sh b/pkgs/build-support/php/builders/v1/hooks/composer-install-hook.sh similarity index 100% rename from pkgs/build-support/php/hooks/composer-install-hook.sh rename to pkgs/build-support/php/builders/v1/hooks/composer-install-hook.sh diff --git a/pkgs/build-support/php/hooks/composer-repository-hook.sh b/pkgs/build-support/php/builders/v1/hooks/composer-repository-hook.sh similarity index 100% rename from pkgs/build-support/php/hooks/composer-repository-hook.sh rename to pkgs/build-support/php/builders/v1/hooks/composer-repository-hook.sh diff --git a/pkgs/build-support/php/hooks/default.nix b/pkgs/build-support/php/builders/v1/hooks/default.nix similarity index 100% rename from pkgs/build-support/php/hooks/default.nix rename to pkgs/build-support/php/builders/v1/hooks/default.nix diff --git a/pkgs/build-support/php/hooks/php-script-utils.bash b/pkgs/build-support/php/builders/v1/hooks/php-script-utils.bash similarity index 100% rename from pkgs/build-support/php/hooks/php-script-utils.bash rename to pkgs/build-support/php/builders/v1/hooks/php-script-utils.bash diff --git a/pkgs/top-level/php-packages.nix b/pkgs/top-level/php-packages.nix index 6af2a8b575f6..e5bcc7ba3c59 100644 --- a/pkgs/top-level/php-packages.nix +++ b/pkgs/top-level/php-packages.nix @@ -48,15 +48,16 @@ lib.makeScope pkgs.newScope (self: let inherit (self) buildPecl callPackage mkExtension php; + + builders = import ../build-support/php/builders { + inherit callPackages callPackage buildPecl; + }; in { buildPecl = callPackage ../build-support/php/build-pecl.nix { php = php.unwrapped; }; - composerHooks = callPackages ../build-support/php/hooks { }; - - mkComposerRepository = callPackage ../build-support/php/build-composer-repository.nix { }; - buildComposerProject = callPackage ../build-support/php/build-composer-project.nix { }; + inherit (builders.v1) buildComposerProject composerHooks mkComposerRepository; # Wrap mkDerivation to prepend pname with "php-" to make names consistent # with how buildPecl does it and make the file easier to overview.