wp-cli: fix wrapper environment (#331050)

This commit is contained in:
Sebastián Mancilla 2024-08-28 20:29:09 -04:00 committed by GitHub
commit eed04f24d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -42,6 +42,9 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [ installShellFiles makeWrapper ];
# Usually --set-default is used to set default environment variables.
# But the value is wrapped in single-quotes so our variables would be used literally instead
# of the expanded version. Thus we use --run instead.
installPhase = ''
runHook preInstall
@ -50,12 +53,12 @@ stdenv.mkDerivation (finalAttrs: {
installShellCompletion --bash --name wp ${completion}
makeWrapper ${lib.getExe php} $out/bin/${finalAttrs.meta.mainProgram} \
--set-default XDG_CACHE_HOME \$HOME/.cache \
--set-default XDG_CONFIG_HOME \$HOME/.config \
--set-default XDG_DATA_HOME \$HOME/.local/share \
--set-default WP_CLI_CONFIG_PATH \$XDG_CONFIG_HOME}/wp-cli \
--set-default WP_CLI_PACKAGES_DIR \$XDG_DATA_HOME/wp-cli \
--set-default WP_CLI_CACHE_DIR \$XDG_CACHE_HOME/wp-cli \
--run 'export XDG_CACHE_HOME=''${XDG_CACHE_HOME-"$HOME/.cache"}' \
--run 'export XDG_CONFIG_HOME=''${XDG_CONFIG_HOME-"$HOME/.config"}' \
--run 'export XDG_DATA_HOME=''${XDG_DATA_HOME-"$HOME/.local/share"}' \
--run 'export WP_CLI_CONFIG_PATH=''${WP_CLI_CONFIG_PATH-"$XDG_CONFIG_HOME/wp-cli"}' \
--run 'export WP_CLI_PACKAGES_DIR=''${WP_CLI_PACKAGES_DIR-"$XDG_DATA_HOME/wp-cli"}' \
--run 'export WP_CLI_CACHE_DIR=''${WP_CLI_CACHE_DIR-"$XDG_CACHE_HOME/wp-cli"}' \
--add-flags "-c $out/etc/${ini.name}" \
--add-flags "-f $out/share/wp-cli/wp-cli.phar" \
--add-flags "--"