diff --git a/pkgs/build-support/php/builders/v1/build-composer-project.nix b/pkgs/build-support/php/builders/v1/build-composer-project.nix index 698391ad1603..912fe7d72f3c 100644 --- a/pkgs/build-support/php/builders/v1/build-composer-project.nix +++ b/pkgs/build-support/php/builders/v1/build-composer-project.nix @@ -94,12 +94,6 @@ let or (if finalAttrs.composerRepository.composerLock == null then nix-update-script { } else null); }; - env = { - COMPOSER_CACHE_DIR = "/dev/null"; - COMPOSER_DISABLE_NETWORK = "1"; - COMPOSER_MIRROR_PATH_REPOS = "1"; - }; - meta = previousAttrs.meta or { } // { platforms = lib.platforms.all; }; diff --git a/pkgs/build-support/php/builders/v1/build-composer-repository.nix b/pkgs/build-support/php/builders/v1/build-composer-repository.nix index 037d8bdeb3eb..c16056ce8fdf 100644 --- a/pkgs/build-support/php/builders/v1/build-composer-repository.nix +++ b/pkgs/build-support/php/builders/v1/build-composer-repository.nix @@ -102,13 +102,6 @@ let runHook postInstallCheck ''; - env = { - 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"; diff --git a/pkgs/build-support/php/builders/v1/build-composer-with-plugin.nix b/pkgs/build-support/php/builders/v1/build-composer-with-plugin.nix index 060b51241e6c..e199000f4f7b 100644 --- a/pkgs/build-support/php/builders/v1/build-composer-with-plugin.nix +++ b/pkgs/build-support/php/builders/v1/build-composer-with-plugin.nix @@ -149,12 +149,6 @@ let or (if finalAttrs.vendor.composerLock == null then nix-update-script { } else null); }; - env = { - COMPOSER_CACHE_DIR = "/dev/null"; - COMPOSER_DISABLE_NETWORK = "1"; - COMPOSER_MIRROR_PATH_REPOS = "1"; - }; - meta = previousAttrs.meta or composer.meta; }; in diff --git a/pkgs/build-support/php/builders/v1/hooks/composer-install-hook.sh b/pkgs/build-support/php/builders/v1/hooks/composer-install-hook.sh index 44e87d06d3a5..1301fca0f058 100644 --- a/pkgs/build-support/php/builders/v1/hooks/composer-install-hook.sh +++ b/pkgs/build-support/php/builders/v1/hooks/composer-install-hook.sh @@ -100,6 +100,7 @@ composerInstallInstallHook() { echo "Executing composerInstallInstallHook" setComposeRootVersion + setComposeEnvVariables # Finally, run `composer install` to install the dependencies and generate # the autoloader. diff --git a/pkgs/build-support/php/builders/v1/hooks/php-script-utils.bash b/pkgs/build-support/php/builders/v1/hooks/php-script-utils.bash index 65c0a3b410f6..a64086a68eef 100644 --- a/pkgs/build-support/php/builders/v1/hooks/php-script-utils.bash +++ b/pkgs/build-support/php/builders/v1/hooks/php-script-utils.bash @@ -13,6 +13,13 @@ setComposeRootVersion() { set -e } +setComposeEnvVariables() { + echo -e "\e[32mSetting some required environment variables for Composer...\e[0m" + export COMPOSER_MIRROR_PATH_REPOS=1 + export COMPOSER_CACHE_DIR=/dev/null + export COMPOSER_HTACCESS_PROTECT=0 +} + checkComposerValidate() { setComposeRootVersion diff --git a/pkgs/build-support/php/builders/v2/build-composer-project.nix b/pkgs/build-support/php/builders/v2/build-composer-project.nix index 6013225e7c59..bfbd2327812b 100644 --- a/pkgs/build-support/php/builders/v2/build-composer-project.nix +++ b/pkgs/build-support/php/builders/v2/build-composer-project.nix @@ -94,12 +94,6 @@ let or (if finalAttrs.composerVendor.composerLock == null then nix-update-script { } else null); }; - env = { - COMPOSER_CACHE_DIR = "/dev/null"; - COMPOSER_DISABLE_NETWORK = "1"; - COMPOSER_MIRROR_PATH_REPOS = "1"; - }; - meta = previousAttrs.meta or { } // { platforms = lib.platforms.all; }; diff --git a/pkgs/build-support/php/builders/v2/build-composer-vendor.nix b/pkgs/build-support/php/builders/v2/build-composer-vendor.nix index b68e16e6cc1a..cbbe643d20f1 100644 --- a/pkgs/build-support/php/builders/v2/build-composer-vendor.nix +++ b/pkgs/build-support/php/builders/v2/build-composer-vendor.nix @@ -87,13 +87,6 @@ let runHook postInstallCheck ''; - env = { - 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"; diff --git a/pkgs/build-support/php/builders/v2/hooks/composer-vendor-hook.sh b/pkgs/build-support/php/builders/v2/hooks/composer-vendor-hook.sh index 21df071e28a2..14522f27a07e 100644 --- a/pkgs/build-support/php/builders/v2/hooks/composer-vendor-hook.sh +++ b/pkgs/build-support/php/builders/v2/hooks/composer-vendor-hook.sh @@ -59,6 +59,8 @@ composerVendorConfigureHook() { composerVendorBuildHook() { echo "Executing composerVendorBuildHook" + setComposeEnvVariables + composer \ `# The acpu-autoloader is not reproducible and has to be disabled.` \ `# Upstream PR: https://github.com/composer/composer/pull/12090` \ diff --git a/pkgs/build-support/php/builders/v2/hooks/php-script-utils.bash b/pkgs/build-support/php/builders/v2/hooks/php-script-utils.bash index 3e8299bf15d3..1ff248a1c111 100644 --- a/pkgs/build-support/php/builders/v2/hooks/php-script-utils.bash +++ b/pkgs/build-support/php/builders/v2/hooks/php-script-utils.bash @@ -13,6 +13,13 @@ setComposeRootVersion() { set -e } +setComposeEnvVariables() { + echo -e "\e[32mSetting some required environment variables for Composer...\e[0m" + export COMPOSER_MIRROR_PATH_REPOS=1 + export COMPOSER_CACHE_DIR=/dev/null + export COMPOSER_HTACCESS_PROTECT=0 +} + checkComposerValidate() { if [ "1" == "${composerGlobal-}" ]; then global="global";