From edc36b3b27027a98d409ca688d088721e2659aa2 Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Thu, 4 Apr 2019 00:05:59 +0200 Subject: [PATCH] Remove usages of `nix show-derivation` in build-desktop.sh for purity --- nix/desktop/default.nix | 6 +++++- nix/desktop/linux/default.nix | 4 ++++ nix/desktop/macos/default.nix | 4 ++++ nix/desktop/windows/default.nix | 4 ++++ scripts/build-desktop.sh | 29 +++++------------------------ 5 files changed, 22 insertions(+), 25 deletions(-) diff --git a/nix/desktop/default.nix b/nix/desktop/default.nix index ae4b006ce5f5..0417f252a31b 100644 --- a/nix/desktop/default.nix +++ b/nix/desktop/default.nix @@ -34,6 +34,10 @@ in unset QT_PATH '' else '' export QT_PATH="${qt5.full}" + export QT_BASEBIN_PATH="${qt5.qtbase.bin}" export PATH="${stdenv.lib.makeBinPath [ qt5.full ]}:$PATH" - ''); + '') + + lib.optionalString targetLinux linuxPlatform.shellHook + + lib.optionalString targetDarwin darwinPlatform.shellHook + + lib.optionalString targetWindows windowsPlatform.shellHook; } diff --git a/nix/desktop/linux/default.nix b/nix/desktop/linux/default.nix index 4bd4844a5895..e4f6f93f4339 100644 --- a/nix/desktop/linux/default.nix +++ b/nix/desktop/linux/default.nix @@ -11,4 +11,8 @@ let in { buildInputs = [ appimagekit linuxdeployqt patchelf baseImage ]; + + shellHook = '' + export STATUSREACT_LINUX_BASEIMAGE_PATH="${baseImage}/src" + ''; } diff --git a/nix/desktop/macos/default.nix b/nix/desktop/macos/default.nix index 7b1d6579c5f9..8b15f4b36804 100644 --- a/nix/desktop/macos/default.nix +++ b/nix/desktop/macos/default.nix @@ -9,4 +9,8 @@ let in { buildInputs = [ baseImage ]; + + shellHook = '' + export STATUSREACT_MACOS_BASEIMAGE_PATH="${baseImage}/src" + ''; } diff --git a/nix/desktop/windows/default.nix b/nix/desktop/windows/default.nix index 876f4c94ab19..a50bc1914e18 100644 --- a/nix/desktop/windows/default.nix +++ b/nix/desktop/windows/default.nix @@ -14,4 +14,8 @@ in baseImage go # Needed for Windows build only ]; + + shellHook = '' + export STATUSREACT_WINDOWS_BASEIMAGE_PATH="${baseImage}/src" + ''; } diff --git a/scripts/build-desktop.sh b/scripts/build-desktop.sh index 20e8b76b44a5..232f1cc25a41 100755 --- a/scripts/build-desktop.sh +++ b/scripts/build-desktop.sh @@ -209,14 +209,12 @@ function bundleWindows() { fi # TODO this needs to be fixed: status-react/issues/5378 - local windowsBaseImagePath="$(nix show-derivation -r -f $STATUSREACTPATH | jq -r '.[] | select(.env.name=="StatusIm-Windows-base-image") | .outputs.out.path')/src/" - local top_srcdir=$(joinExistingPath "$STATUSREACTPATH" '.') VERSION_MAJOR="$(cut -d'.' -f1 <<<"$VERSION")" VERSION_MINOR="$(cut -d'.' -f2 <<<"$VERSION")" VERSION_BUILD="$(cut -d'.' -f3 <<<"$VERSION")" makensis -Dtop_srcdir=${top_srcdir} \ - -Dbase_image_dir=${windowsBaseImagePath} \ + -Dbase_image_dir=${STATUSREACT_WINDOWS_BASEIMAGE_PATH} \ -DCOMPRESSION_ALGO=${compressionAlgo} \ -DCOMPRESSION_TYPE=${compressionType} \ -DVERSION_MAJOR=$VERSION_MAJOR \ @@ -239,8 +237,7 @@ function bundleLinux() { rm -rf StatusImAppImage AppDir # TODO this needs to be fixed: status-react/issues/5378 - local baseAppImagePath="$(nix show-derivation -r -f $STATUSREACTPATH | jq -r '.[] | select(.env.name=="StatusImAppImage") | .outputs.out.path')/src" - cp -r $baseAppImagePath/StatusImAppImage . + cp -r ${STATUSREACT_LINUX_BASEIMAGE_PATH}/StatusImAppImage . chmod -R +w StatusImAppImage/ mkdir AppDir @@ -305,19 +302,6 @@ function bundleLinux() { } if is_macos; then - function getQtFullOutPathFromNixStore() { - local qtFullDerivationPath=$(nix show-derivation -f $STATUSREACTPATH/default.nix | jq -r '.[] | .inputDrvs | 'keys' | .[]' | grep qt-full) - - echo $(nix show-derivation $qtFullDerivationPath | jq -r '.[] | .outputs.out.path') - } - - function getQtBaseBinPathFromNixStore() { - local qtFullDerivationPath=$(nix show-derivation -f $STATUSREACTPATH/default.nix | jq -r '.[] | .inputDrvs | 'keys' | .[]' | grep qt-full) - local qtBaseDerivationPath=$(nix show-derivation $qtFullDerivationPath | jq -r '.[] | .inputDrvs | 'keys' | .[]' | grep qtbase) - - echo $(nix show-derivation $qtBaseDerivationPath | jq -r '.[] | .outputs.bin.path') - } - function copyDylibNixDependenciesToPackage() { local dylib="$1" local contentsDir="$2" @@ -444,8 +428,7 @@ function bundleMacOS() { # download prepared package with mac bundle files (it contains qt libraries, icon) rm -rf Status.app # TODO this needs to be fixed: status-react/issues/5378 - local baseAppImagePath="$(nix show-derivation -r -f $STATUSREACTPATH | jq -r '.[] | select(.env.name=="StatusImAppBundle") | .outputs.out.path')/src" - cp -r $baseAppImagePath/Status.app . + cp -r ${STATUSREACT_MACOS_BASEIMAGE_PATH}/Status.app . chmod -R +w Status.app/ local contentsPath='Status.app/Contents' @@ -468,11 +451,9 @@ function bundleMacOS() { if program_exists nix && [ -n "$IN_NIX_SHELL" ]; then # Since in the Nix qt.full package the different Qt modules are spread across several directories, # macdeployqt cannot find some qtbase plugins, so we copy them in its place - local qtbaseBinPath=$(getQtBaseBinPathFromNixStore) - local qtfullOutPath=$(getQtFullOutPathFromNixStore) mkdir -p "$contentsPath/PlugIns" - for plugin in ${qtbaseplugins[@]}; do copyQtPlugInToPackage "$qtbaseBinPath" "$plugin" "$contentsPath"; done - for plugin in ${qtfullplugins[@]}; do copyQtPlugInToPackage "$qtfullOutPath" "$plugin" "$contentsPath"; done + for plugin in ${qtbaseplugins[@]}; do copyQtPlugInToPackage "$QT_BASEBIN_PATH" "$plugin" "$contentsPath"; done + for plugin in ${qtfullplugins[@]}; do copyQtPlugInToPackage "$QT_PATH" "$plugin" "$contentsPath"; done fi macdeployqt Status.app \