Remove usages of `nix show-derivation` in build-desktop.sh for purity

Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
Pedro Pombeiro 2019-04-04 00:05:59 +02:00
parent f048b8a80d
commit ea837ff353
No known key found for this signature in database
GPG Key ID: C4A24185B2AA48A1
5 changed files with 22 additions and 25 deletions

View File

@ -34,6 +34,10 @@ in
unset QT_PATH unset QT_PATH
'' else '' '' else ''
export QT_PATH="${qt5.full}" export QT_PATH="${qt5.full}"
export QT_BASEBIN_PATH="${qt5.qtbase.bin}"
export PATH="${stdenv.lib.makeBinPath [ qt5.full ]}:$PATH" export PATH="${stdenv.lib.makeBinPath [ qt5.full ]}:$PATH"
''); '') +
lib.optionalString targetLinux linuxPlatform.shellHook +
lib.optionalString targetDarwin darwinPlatform.shellHook +
lib.optionalString targetWindows windowsPlatform.shellHook;
} }

View File

@ -11,4 +11,8 @@ let
in in
{ {
buildInputs = [ appimagekit linuxdeployqt patchelf baseImage ]; buildInputs = [ appimagekit linuxdeployqt patchelf baseImage ];
shellHook = ''
export STATUSREACT_LINUX_BASEIMAGE_PATH="${baseImage}/src"
'';
} }

View File

@ -9,4 +9,8 @@ let
in in
{ {
buildInputs = [ baseImage ]; buildInputs = [ baseImage ];
shellHook = ''
export STATUSREACT_MACOS_BASEIMAGE_PATH="${baseImage}/src"
'';
} }

View File

@ -14,4 +14,8 @@ in
baseImage baseImage
go # Needed for Windows build only go # Needed for Windows build only
]; ];
shellHook = ''
export STATUSREACT_WINDOWS_BASEIMAGE_PATH="${baseImage}/src"
'';
} }

View File

@ -209,14 +209,12 @@ function bundleWindows() {
fi fi
# TODO this needs to be fixed: status-react/issues/5378 # 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" '.') local top_srcdir=$(joinExistingPath "$STATUSREACTPATH" '.')
VERSION_MAJOR="$(cut -d'.' -f1 <<<"$VERSION")" VERSION_MAJOR="$(cut -d'.' -f1 <<<"$VERSION")"
VERSION_MINOR="$(cut -d'.' -f2 <<<"$VERSION")" VERSION_MINOR="$(cut -d'.' -f2 <<<"$VERSION")"
VERSION_BUILD="$(cut -d'.' -f3 <<<"$VERSION")" VERSION_BUILD="$(cut -d'.' -f3 <<<"$VERSION")"
makensis -Dtop_srcdir=${top_srcdir} \ makensis -Dtop_srcdir=${top_srcdir} \
-Dbase_image_dir=${windowsBaseImagePath} \ -Dbase_image_dir=${STATUSREACT_WINDOWS_BASEIMAGE_PATH} \
-DCOMPRESSION_ALGO=${compressionAlgo} \ -DCOMPRESSION_ALGO=${compressionAlgo} \
-DCOMPRESSION_TYPE=${compressionType} \ -DCOMPRESSION_TYPE=${compressionType} \
-DVERSION_MAJOR=$VERSION_MAJOR \ -DVERSION_MAJOR=$VERSION_MAJOR \
@ -239,8 +237,7 @@ function bundleLinux() {
rm -rf StatusImAppImage AppDir rm -rf StatusImAppImage AppDir
# TODO this needs to be fixed: status-react/issues/5378 # 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 ${STATUSREACT_LINUX_BASEIMAGE_PATH}/StatusImAppImage .
cp -r $baseAppImagePath/StatusImAppImage .
chmod -R +w StatusImAppImage/ chmod -R +w StatusImAppImage/
mkdir AppDir mkdir AppDir
@ -305,19 +302,6 @@ function bundleLinux() {
} }
if is_macos; then 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() { function copyDylibNixDependenciesToPackage() {
local dylib="$1" local dylib="$1"
local contentsDir="$2" local contentsDir="$2"
@ -444,8 +428,7 @@ function bundleMacOS() {
# download prepared package with mac bundle files (it contains qt libraries, icon) # download prepared package with mac bundle files (it contains qt libraries, icon)
rm -rf Status.app rm -rf Status.app
# TODO this needs to be fixed: status-react/issues/5378 # 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 ${STATUSREACT_MACOS_BASEIMAGE_PATH}/Status.app .
cp -r $baseAppImagePath/Status.app .
chmod -R +w Status.app/ chmod -R +w Status.app/
local contentsPath='Status.app/Contents' local contentsPath='Status.app/Contents'
@ -468,11 +451,9 @@ function bundleMacOS() {
if program_exists nix && [ -n "$IN_NIX_SHELL" ]; then 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, # 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 # macdeployqt cannot find some qtbase plugins, so we copy them in its place
local qtbaseBinPath=$(getQtBaseBinPathFromNixStore)
local qtfullOutPath=$(getQtFullOutPathFromNixStore)
mkdir -p "$contentsPath/PlugIns" mkdir -p "$contentsPath/PlugIns"
for plugin in ${qtbaseplugins[@]}; do copyQtPlugInToPackage "$qtbaseBinPath" "$plugin" "$contentsPath"; done for plugin in ${qtbaseplugins[@]}; do copyQtPlugInToPackage "$QT_BASEBIN_PATH" "$plugin" "$contentsPath"; done
for plugin in ${qtfullplugins[@]}; do copyQtPlugInToPackage "$qtfullOutPath" "$plugin" "$contentsPath"; done for plugin in ${qtfullplugins[@]}; do copyQtPlugInToPackage "$QT_PATH" "$plugin" "$contentsPath"; done
fi fi
macdeployqt Status.app \ macdeployqt Status.app \