Skip to content

Commit 07e6929

Browse files
committed
build-support/php: fix environment variables for Composer
1 parent 3bcaabb commit 07e6929

File tree

9 files changed

+17
-32
lines changed

9 files changed

+17
-32
lines changed

pkgs/build-support/php/builders/v1/build-composer-project.nix

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ let
9494
or (if finalAttrs.composerRepository.composerLock == null then nix-update-script { } else null);
9595
};
9696

97-
env = {
98-
COMPOSER_CACHE_DIR = "/dev/null";
99-
COMPOSER_DISABLE_NETWORK = "1";
100-
COMPOSER_MIRROR_PATH_REPOS = "1";
101-
};
102-
10397
meta = previousAttrs.meta or { } // {
10498
platforms = lib.platforms.all;
10599
};

pkgs/build-support/php/builders/v1/build-composer-repository.nix

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,6 @@ let
102102
runHook postInstallCheck
103103
'';
104104

105-
env = {
106-
COMPOSER_CACHE_DIR = "/dev/null";
107-
COMPOSER_MIRROR_PATH_REPOS = "1";
108-
COMPOSER_HTACCESS_PROTECT = "0";
109-
COMPOSER_DISABLE_NETWORK = "0";
110-
};
111-
112105
outputHashMode = "recursive";
113106
outputHashAlgo =
114107
if (finalAttrs ? vendorHash && finalAttrs.vendorHash != "") then null else "sha256";

pkgs/build-support/php/builders/v1/build-composer-with-plugin.nix

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,6 @@ let
149149
or (if finalAttrs.vendor.composerLock == null then nix-update-script { } else null);
150150
};
151151

152-
env = {
153-
COMPOSER_CACHE_DIR = "/dev/null";
154-
COMPOSER_DISABLE_NETWORK = "1";
155-
COMPOSER_MIRROR_PATH_REPOS = "1";
156-
};
157-
158152
meta = previousAttrs.meta or composer.meta;
159153
};
160154
in

pkgs/build-support/php/builders/v1/hooks/composer-install-hook.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ composerInstallInstallHook() {
100100
echo "Executing composerInstallInstallHook"
101101

102102
setComposeRootVersion
103+
setComposeEnvVariables
103104

104105
# Finally, run `composer install` to install the dependencies and generate
105106
# the autoloader.

pkgs/build-support/php/builders/v1/hooks/php-script-utils.bash

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ setComposeRootVersion() {
1313
set -e
1414
}
1515

16+
setComposeEnvVariables() {
17+
echo -e "\e[32mSetting some required environment variables for Composer...\e[0m"
18+
export COMPOSER_MIRROR_PATH_REPOS=1
19+
export COMPOSER_CACHE_DIR=/dev/null
20+
export COMPOSER_HTACCESS_PROTECT=0
21+
}
22+
1623
checkComposerValidate() {
1724
setComposeRootVersion
1825

pkgs/build-support/php/builders/v2/build-composer-project.nix

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ let
9494
or (if finalAttrs.composerVendor.composerLock == null then nix-update-script { } else null);
9595
};
9696

97-
env = {
98-
COMPOSER_CACHE_DIR = "/dev/null";
99-
COMPOSER_DISABLE_NETWORK = "1";
100-
COMPOSER_MIRROR_PATH_REPOS = "1";
101-
};
102-
10397
meta = previousAttrs.meta or { } // {
10498
platforms = lib.platforms.all;
10599
};

pkgs/build-support/php/builders/v2/build-composer-vendor.nix

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,6 @@ let
8787
runHook postInstallCheck
8888
'';
8989

90-
env = {
91-
COMPOSER_CACHE_DIR = "/dev/null";
92-
COMPOSER_MIRROR_PATH_REPOS = "1";
93-
COMPOSER_HTACCESS_PROTECT = "0";
94-
COMPOSER_DISABLE_NETWORK = "0";
95-
};
96-
9790
outputHashMode = "recursive";
9891
outputHashAlgo =
9992
if (finalAttrs ? vendorHash && finalAttrs.vendorHash != "") then null else "sha256";

pkgs/build-support/php/builders/v2/hooks/composer-vendor-hook.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ composerVendorConfigureHook() {
5959
composerVendorBuildHook() {
6060
echo "Executing composerVendorBuildHook"
6161

62+
setComposeEnvVariables
63+
6264
composer \
6365
`# The acpu-autoloader is not reproducible and has to be disabled.` \
6466
`# Upstream PR: https://github.com/composer/composer/pull/12090` \

pkgs/build-support/php/builders/v2/hooks/php-script-utils.bash

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ setComposeRootVersion() {
1313
set -e
1414
}
1515

16+
setComposeEnvVariables() {
17+
echo -e "\e[32mSetting some required environment variables for Composer...\e[0m"
18+
export COMPOSER_MIRROR_PATH_REPOS=1
19+
export COMPOSER_CACHE_DIR=/dev/null
20+
export COMPOSER_HTACCESS_PROTECT=0
21+
}
22+
1623
checkComposerValidate() {
1724
if [ "1" == "${composerGlobal-}" ]; then
1825
global="global";

0 commit comments

Comments
 (0)