From c53553e137a54cc106423331fc56fefc4d34a287 Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Thu, 21 Mar 2019 17:56:22 +0100 Subject: [PATCH] Use nix to download Desktop bundle base images Signed-off-by: Pedro Pombeiro --- .TOOLVERSIONS | 2 + ci/Jenkinsfile.android | 2 +- ci/Jenkinsfile.linux | 6 +-- ci/Jenkinsfile.nix.linux | 2 +- ci/Jenkinsfile.windows | 2 +- ci/docker/nix/Dockerfile | 2 + ci/docker/nix/Makefile | 5 +- default.nix | 4 ++ deployment/windows/nsis/setup.nsi | 3 +- scripts/build-desktop.sh | 52 +++++++------------ scripts/gen-deps-hash.sh | 2 +- scripts/lib/setup/nix/desktop/default.nix | 18 ++++--- .../{ => linux}/appimagekit/default.nix | 3 +- .../desktop/{ => linux}/appimagekit/nix.patch | 0 .../nix/desktop/linux/base-image/default.nix | 32 ++++++++++++ .../lib/setup/nix/desktop/linux/default.nix | 14 +++++ .../{ => linux}/linuxdeployqt/default.nix | 0 .../linuxdeployqt/linuxdeployqt.patch | 0 .../nix/desktop/macos/base-image/default.nix | 32 ++++++++++++ .../lib/setup/nix/desktop/macos/default.nix | 12 +++++ .../desktop/windows/base-image/default.nix | 40 ++++++++++++++ .../lib/setup/nix/desktop/windows/default.nix | 8 ++- scripts/lib/setup/nix/mobile/default.nix | 2 +- 23 files changed, 190 insertions(+), 53 deletions(-) rename scripts/lib/setup/nix/desktop/{ => linux}/appimagekit/default.nix (96%) rename scripts/lib/setup/nix/desktop/{ => linux}/appimagekit/nix.patch (100%) create mode 100644 scripts/lib/setup/nix/desktop/linux/base-image/default.nix create mode 100644 scripts/lib/setup/nix/desktop/linux/default.nix rename scripts/lib/setup/nix/desktop/{ => linux}/linuxdeployqt/default.nix (100%) rename scripts/lib/setup/nix/desktop/{ => linux}/linuxdeployqt/linuxdeployqt.patch (100%) create mode 100644 scripts/lib/setup/nix/desktop/macos/base-image/default.nix create mode 100644 scripts/lib/setup/nix/desktop/macos/default.nix create mode 100644 scripts/lib/setup/nix/desktop/windows/base-image/default.nix diff --git a/.TOOLVERSIONS b/.TOOLVERSIONS index 72b9338716..d633a3165c 100644 --- a/.TOOLVERSIONS +++ b/.TOOLVERSIONS @@ -3,3 +3,5 @@ android-sdk-platform;android-27; android-sdk;4333796;aa190cfd7299cd6a1c687355bb2764e4 nix;2.2.1; react_native_cli;2.0.1; +StatusImAppImage;20181208; +StatusIm-Windows-base-image;20181113; \ No newline at end of file diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index 079ef22f3f..baf08cfdac 100644 --- a/ci/Jenkinsfile.android +++ b/ci/Jenkinsfile.android @@ -2,7 +2,7 @@ pipeline { agent { docker { label 'linux' - image 'statusteam/nix:jenkins-1.0.0-4a147dc3' + image 'statusteam/nix:jenkins-1.0.0-158e62e1' args ( "-v /home/jenkins/tmp:/var/tmp:rw "+ "-v /home/jenkins/status-im.keystore:/tmp/status-im.keystore:ro" diff --git a/ci/Jenkinsfile.linux b/ci/Jenkinsfile.linux index f9649f1d3c..f846b9bfe7 100644 --- a/ci/Jenkinsfile.linux +++ b/ci/Jenkinsfile.linux @@ -2,12 +2,11 @@ pipeline { agent { docker { label 'linux' - image 'statusteam/nix:jenkins-1.0.0-4a147dc3' + image 'statusteam/nix:jenkins-1.0.0-158e62e1' args ( "-v /tmp/Android/Sdk:/home/jenkins/.status/Android/Sdk:rw "+ "-v /var/tmp/lein:/var/tmp/lein:rw "+ - "-v /var/tmp/npm:/var/tmp/npm:rw "+ - "-v /opt/desktop-files:/opt/desktop-files:rw" + "-v /var/tmp/npm:/var/tmp/npm:rw " ) } } @@ -45,7 +44,6 @@ pipeline { CI_ENVIRONMENT = 'jenkins' LEIN_HOME = '/var/tmp/lein' NIX_CONF_DIR = "${env.WORKSPACE}/scripts/lib/setup/nix" - STATUSIM_APPIMAGE_DIR = '/opt/desktop-files' VERBOSE_LEVEL = '3' } diff --git a/ci/Jenkinsfile.nix.linux b/ci/Jenkinsfile.nix.linux index 4333245f1b..41c0ffbf68 100644 --- a/ci/Jenkinsfile.nix.linux +++ b/ci/Jenkinsfile.nix.linux @@ -3,7 +3,7 @@ pipeline { /* the -u is necessary for acces to /nix */ docker { label 'linux' - image 'statusteam/nix:jenkins-1.0.0-4a147dc3' + image 'statusteam/nix:jenkins-1.0.0-158e62e1' } } diff --git a/ci/Jenkinsfile.windows b/ci/Jenkinsfile.windows index ece4b53550..0548439ef4 100644 --- a/ci/Jenkinsfile.windows +++ b/ci/Jenkinsfile.windows @@ -2,7 +2,7 @@ pipeline { agent { docker { label 'linux-new' - image 'statusteam/nix:jenkins-1.0.0-4a147dc3' + image 'statusteam/nix:jenkins-1.0.0-158e62e1' args ( "-v /var/tmp/lein:/var/tmp/lein:rw "+ "-v /var/tmp/npm:/var/tmp/npm:rw " diff --git a/ci/docker/nix/Dockerfile b/ci/docker/nix/Dockerfile index 406935d612..1936762b99 100644 --- a/ci/docker/nix/Dockerfile +++ b/ci/docker/nix/Dockerfile @@ -46,6 +46,8 @@ ENV LANG=en_US.UTF-8 \ LANGUAGE=en_US.UTF-8 ARG NIX_VERSION +# DEPS_HASH is not used expect for a new image to be created in case some indirect dependency changes (e.g. a download brought by nix-shell) +ARG DEPS_HASH ARG ANDROID_SDK_VERSION ARG JENKINS_UID ARG JENKINS_GID diff --git a/ci/docker/nix/Makefile b/ci/docker/nix/Makefile index edd67505ca..c40089dff5 100644 --- a/ci/docker/nix/Makefile +++ b/ci/docker/nix/Makefile @@ -23,7 +23,9 @@ DEPS_HASH = $(shell $(GIT_ROOT)/scripts/gen-deps-hash.sh -b $(NIX_SHA) \ -d android-sdk \ -d android-sdk-platform \ -d android-sdk-build-tools \ - -d nix) + -d nix \ + -d StatusImAppImage \ + -d StatusIm-Windows-base-image) IMAGE_TAG = jenkins-1.0.0-$(DEPS_HASH) IMAGE_NAME = statusteam/nix:$(IMAGE_TAG) @@ -36,6 +38,7 @@ build: $(NIX_INSTALL) $(ANDROID_SDK_ARCHIVE) --build-arg="ANDROID_SDK_VERSION=$(ANDROID_SDK_VERSION)" \ --build-arg="SDK_BUILD_TOOLS_VERSION=$(SDK_BUILD_TOOLS_VERSION)" \ --build-arg="SDK_PLATFORM_VERSION=$(SDK_PLATFORM_VERSION)" \ + --build-arg="DEPS_HASH=$(DEPS_HASH)" \ -t $(IMAGE_NAME) . $(NIX_INSTALL): diff --git a/default.nix b/default.nix index 73c4fca763..e8d2b8d232 100644 --- a/default.nix +++ b/default.nix @@ -57,11 +57,15 @@ with pkgs; ++ lib.optional targetDesktop statusDesktop.buildInputs ++ lib.optional targetMobile statusMobile.buildInputs; shellHook = + '' + set -e + '' + lib.optionalString targetDesktop statusDesktop.shellHook + lib.optionalString targetMobile statusMobile.shellHook + '' if [ -n "$ANDROID_SDK_ROOT" ] && [ ! -d "$ANDROID_SDK_ROOT" ]; then ./scripts/setup # we assume that if the Android SDK dir does not exist, make setup needs to be run fi + set +e ''; } diff --git a/deployment/windows/nsis/setup.nsi b/deployment/windows/nsis/setup.nsi index b4dc997272..70318f64f3 100644 --- a/deployment/windows/nsis/setup.nsi +++ b/deployment/windows/nsis/setup.nsi @@ -4,6 +4,7 @@ ;Unicode true ;!define top_srcdir @top_srcdir@ + ;!define base_image_dir "" ;!define srcdir @srcdir@ !define VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD} !define VERSION_FULL ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}.0 @@ -626,7 +627,7 @@ Section "Status Desktop" SecMain File "${top_srcdir}\.env" File "${top_srcdir}\node_modules\node-notifier\vendor\snoreToast\SnoreToast.exe" File /r "${top_srcdir}\desktop\bin\" - File /r "${top_srcdir}\StatusImPackage\Windows\" + File /r "${base_image_dir}" SetOutPath "$INSTDIR\notifier" File "${top_srcdir}\node_modules\node-notifier\vendor\notifu\*.exe" diff --git a/scripts/build-desktop.sh b/scripts/build-desktop.sh index ea7eab8472..11b28e905c 100755 --- a/scripts/build-desktop.sh +++ b/scripts/build-desktop.sh @@ -83,7 +83,6 @@ fi STATUSREACTPATH="$(cd "$SCRIPTPATH" && cd '..' && pwd)" WORKFOLDER="$(joinExistingPath "$STATUSREACTPATH" 'StatusImPackage')" -STATUSIM_APPIMAGE_ARCHIVE="StatusImAppImage_20181208.zip" function init() { if [ -z $STATUSREACTPATH ]; then @@ -193,19 +192,8 @@ function bundleWindows() { exit 1 fi - pushd $WORKFOLDER - rm -rf Windows - mkdir Windows - - if [ -z $STATUSIM_WINDOWS_BASEIMAGE_ZIP ]; then - STATUSIM_WINDOWS_BASEIMAGE_ZIP=./StatusIm-Windows-base-image.zip - [ -f $STATUSIM_WINDOWS_BASEIMAGE_ZIP ] || wget https://desktop-app-files.ams3.digitaloceanspaces.com/StatusIm-Windows-base-image_20181113.zip -O StatusIm-Windows-base-image.zip - fi - unzip "$STATUSIM_WINDOWS_BASEIMAGE_ZIP" -d Windows/ - - pushd $STATUSREACTPATH/desktop/bin - rm -rf cmake_install.cmake Makefile CMakeFiles Status_autogen - popd + pushd $STATUSREACTPATH/desktop/bin + rm -rf cmake_install.cmake Makefile CMakeFiles Status_autogen popd local compressionAlgo="lzma" @@ -217,11 +205,15 @@ function bundleWindows() { compressionAlgo="zlib" 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} \ -DCOMPRESSION_ALGO=${compressionAlgo} \ -DCOMPRESSION_TYPE=${compressionType} \ -DVERSION_MAJOR=$VERSION_MAJOR \ @@ -239,24 +231,21 @@ function bundleLinux() { QTBIN=$(joinExistingPath "$QT_PATH" 'bin') fi - # invoke linuxdeployqt to create Status.AppImage echo "Creating AppImage..." pushd $WORKFOLDER - rm -rf StatusImAppImage + rm -rf StatusImAppImage AppDir + # TODO this needs to be fixed: status-react/issues/5378 - if [ -z $STATUSIM_APPIMAGE_DIR ]; then - STATUSIM_APPIMAGE="./${STATUSIM_APPIMAGE_ARCHIVE}" - else - STATUSIM_APPIMAGE="${STATUSIM_APPIMAGE_DIR}/${STATUSIM_APPIMAGE_ARCHIVE}" - fi - [ -f $STATUSIM_APPIMAGE ] || wget "https://desktop-app-files.ams3.digitaloceanspaces.com/${STATUSIM_APPIMAGE_ARCHIVE}" -O $STATUSIM_APPIMAGE - unzip "$STATUSIM_APPIMAGE" -d . - rm -rf AppDir + local baseAppImagePath="$(nix show-derivation -r -f $STATUSREACTPATH | jq -r '.[] | select(.env.name=="StatusImAppImage") | .outputs.out.path')/src" + cp -r $baseAppImagePath/StatusImAppImage . + chmod -R +w StatusImAppImage/ + mkdir AppDir popd - qmakePath="$(joinExistingPath "${QTBIN}" 'qmake')" - usrBinPath="$(joinPath "$WORKFOLDER" "AppDir/usr/bin")" + # invoke linuxdeployqt to create Status.AppImage + local qmakePath="$(joinExistingPath "${QTBIN}" 'qmake')" + local usrBinPath="$(joinPath "$WORKFOLDER" "AppDir/usr/bin")" cp -r ./deployment/linux/usr $WORKFOLDER/AppDir cp ./.env $usrBinPath cp ./desktop/bin/Status ./desktop/bin/reportApp $usrBinPath @@ -264,13 +253,13 @@ function bundleLinux() { rm -f Application-x86_64.AppImage Status-x86_64.AppImage [ $VERBOSE_LEVEL -ge 1 ] && ldd $(joinExistingPath "$usrBinPath" 'Status') - desktopFilePath="$(joinExistingPath "$WORKFOLDER" 'AppDir/usr/share/applications/Status.desktop')" pushd $WORKFOLDER cp -r assets/share/assets $usrBinPath cp -rf StatusImAppImage/* $usrBinPath rm -f $usrBinPath/Status.AppImage popd + local desktopFilePath="$(joinExistingPath "$WORKFOLDER" 'AppDir/usr/share/applications/Status.desktop')" linuxdeployqt \ $desktopFilePath \ -verbose=$VERBOSE_LEVEL -always-overwrite -no-strip \ @@ -450,14 +439,11 @@ fi function bundleMacOS() { pushd $WORKFOLDER # download prepared package with mac bundle files (it contains qt libraries, icon) - echo "Downloading skeleton of mac bundle..." - rm -rf Status.app # TODO this needs to be fixed: status-react/issues/5378 - [ -f ./Status.app.zip ] || curl -L -o Status.app.zip https://desktop-app-files.ams3.digitaloceanspaces.com/Status_20181113.app.zip - echo -e "${GREEN}Downloading done.${NC}" - echo "" - unzip ./Status.app.zip + local baseAppImagePath="$(nix show-derivation -r -f $STATUSREACTPATH | jq -r '.[] | select(.env.name=="StatusImAppBundle") | .outputs.out.path')/src" + cp -r $baseAppImagePath/Status.app . + chmod -R +w Status.app/ local contentsPath='Status.app/Contents' local usrBinPath=$(joinExistingPath "$WORKFOLDER" "$contentsPath/MacOS") diff --git a/scripts/gen-deps-hash.sh b/scripts/gen-deps-hash.sh index 4dcdc4fd8c..e0f20b06a8 100755 --- a/scripts/gen-deps-hash.sh +++ b/scripts/gen-deps-hash.sh @@ -20,7 +20,7 @@ usage () { deps=() while getopts "hb:d:" opt; do case $opt in - b) base_hash="$OPTARG";; + b) base_hash="${base_hash}${OPTARG}";; d) version=$($toolversion "$OPTARG") if [ $? -ne 0 ]; then diff --git a/scripts/lib/setup/nix/desktop/default.nix b/scripts/lib/setup/nix/desktop/default.nix index db9dc59ab9..a841cc7f2d 100644 --- a/scripts/lib/setup/nix/desktop/default.nix +++ b/scripts/lib/setup/nix/desktop/default.nix @@ -1,20 +1,24 @@ { stdenv, pkgs, target-os }: with pkgs; -with stdenv; +with stdenv; let targetLinux = { "linux" = true; "" = isLinux; }.${target-os} or false; + targetDarwin = { + "macos" = true; + "" = isDarwin; + }.${target-os} or false; targetWindows = { "windows" = true; "" = isLinux; }.${target-os} or false; + linuxPlatform = callPackage ./linux { }; + darwinPlatform = callPackage ./macos { }; windowsPlatform = callPackage ./windows { }; - appimagekit = callPackage ./appimagekit { }; - linuxdeployqt = callPackage ./linuxdeployqt { inherit appimagekit; }; in { @@ -22,12 +26,14 @@ in cmake extra-cmake-modules file - gnupg # Used by appimagetool go - ] ++ lib.optional targetLinux [ appimagekit linuxdeployqt patchelf ] + ] ++ lib.optional targetLinux linuxPlatform.buildInputs + ++ lib.optional targetDarwin darwinPlatform.buildInputs ++ lib.optional (! targetWindows) qt5.full ++ lib.optional targetWindows windowsPlatform.buildInputs; - shellHook = (if target-os == "windows" then "unset QT_PATH" else '' + shellHook = (if target-os == "windows" then '' + unset QT_PATH + '' else '' export QT_PATH="${qt5.full}" export PATH="${stdenv.lib.makeBinPath [ qt5.full ]}:$PATH" '') + (lib.optionalString isDarwin '' diff --git a/scripts/lib/setup/nix/desktop/appimagekit/default.nix b/scripts/lib/setup/nix/desktop/linux/appimagekit/default.nix similarity index 96% rename from scripts/lib/setup/nix/desktop/appimagekit/default.nix rename to scripts/lib/setup/nix/desktop/linux/appimagekit/default.nix index b8cc0184db..2bae6214ed 100644 --- a/scripts/lib/setup/nix/desktop/appimagekit/default.nix +++ b/scripts/lib/setup/nix/desktop/linux/appimagekit/default.nix @@ -1,7 +1,7 @@ { stdenv, fetchFromGitHub , pkgconfig, cmake, autoconf, automake, libtool , wget, xxd, desktop-file-utils, file -, glib, zlib, cairo, openssl, fuse, xz, squashfuse, inotify-tools, libarchive +, gnupg, glib, zlib, cairo, openssl, fuse, xz, squashfuse, inotify-tools, libarchive , squashfsTools , gtest }: @@ -70,6 +70,7 @@ in stdenv.mkDerivation rec { ]; buildInputs = [ + gnupg glib zlib cairo openssl fuse xz inotify-tools libarchive squashfsTools diff --git a/scripts/lib/setup/nix/desktop/appimagekit/nix.patch b/scripts/lib/setup/nix/desktop/linux/appimagekit/nix.patch similarity index 100% rename from scripts/lib/setup/nix/desktop/appimagekit/nix.patch rename to scripts/lib/setup/nix/desktop/linux/appimagekit/nix.patch diff --git a/scripts/lib/setup/nix/desktop/linux/base-image/default.nix b/scripts/lib/setup/nix/desktop/linux/base-image/default.nix new file mode 100644 index 0000000000..96a5941135 --- /dev/null +++ b/scripts/lib/setup/nix/desktop/linux/base-image/default.nix @@ -0,0 +1,32 @@ +{ pkgs, stdenv, fetchurl }: + +with pkgs; + +stdenv.mkDerivation rec { + name = "StatusImAppImage"; + version = "20181208"; + + src = + if stdenv.hostPlatform.system == "x86_64-linux" then + fetchurl { + url = "https://desktop-app-files.ams3.digitaloceanspaces.com/${name}_${version}.zip"; + sha256 = "15c6p5v6325kj2whc298dn1dyigi0yzk2nzh1y10d03aqr4j8mp5"; + } + else throw "${name} is not supported on ${stdenv.hostPlatform.system}"; + + nativeBuildInputs = [ unzip ]; + + phases = [ "unpackPhase" ]; + unpackPhase = '' + mkdir -p $out/src + unzip $src -d $out/src + ''; + + meta = { + description = "A base image for Linux Status Desktop release distributions"; + homepage = https://desktop-app-files.ams3.digitaloceanspaces.com/; + license = stdenv.lib.licenses.gpl3; + maintainers = [ stdenv.lib.maintainers.pombeirp ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/scripts/lib/setup/nix/desktop/linux/default.nix b/scripts/lib/setup/nix/desktop/linux/default.nix new file mode 100644 index 0000000000..4bd4844a58 --- /dev/null +++ b/scripts/lib/setup/nix/desktop/linux/default.nix @@ -0,0 +1,14 @@ +{ stdenv, pkgs }: + +with pkgs; +with stdenv; + +let + baseImage = callPackage ./base-image { }; + appimagekit = callPackage ./appimagekit { }; + linuxdeployqt = callPackage ./linuxdeployqt { inherit appimagekit; }; + +in +{ + buildInputs = [ appimagekit linuxdeployqt patchelf baseImage ]; +} diff --git a/scripts/lib/setup/nix/desktop/linuxdeployqt/default.nix b/scripts/lib/setup/nix/desktop/linux/linuxdeployqt/default.nix similarity index 100% rename from scripts/lib/setup/nix/desktop/linuxdeployqt/default.nix rename to scripts/lib/setup/nix/desktop/linux/linuxdeployqt/default.nix diff --git a/scripts/lib/setup/nix/desktop/linuxdeployqt/linuxdeployqt.patch b/scripts/lib/setup/nix/desktop/linux/linuxdeployqt/linuxdeployqt.patch similarity index 100% rename from scripts/lib/setup/nix/desktop/linuxdeployqt/linuxdeployqt.patch rename to scripts/lib/setup/nix/desktop/linux/linuxdeployqt/linuxdeployqt.patch diff --git a/scripts/lib/setup/nix/desktop/macos/base-image/default.nix b/scripts/lib/setup/nix/desktop/macos/base-image/default.nix new file mode 100644 index 0000000000..b9938b0792 --- /dev/null +++ b/scripts/lib/setup/nix/desktop/macos/base-image/default.nix @@ -0,0 +1,32 @@ +{ pkgs, stdenv, fetchurl }: + +with pkgs; + +stdenv.mkDerivation rec { + name = "StatusImAppBundle"; + version = "20181113"; + + src = + if stdenv.hostPlatform.system == "x86_64-darwin" then + fetchurl { + url = "https://desktop-app-files.ams3.digitaloceanspaces.com/Status_${version}.app.zip"; + sha256 = "0n8n6p60dwsr4q5v4vq8fffcy5qmqhp03yy95k66q4yic72r0hhz"; + } + else throw "${name} is not supported on ${stdenv.hostPlatform.system}"; + + nativeBuildInputs = [ unzip ]; + + phases = [ "unpackPhase" ]; + unpackPhase = '' + mkdir -p $out/src + unzip $src -d $out/src + ''; + + meta = { + description = "A base image for macOS Status Desktop release distributions"; + homepage = https://desktop-app-files.ams3.digitaloceanspaces.com/; + license = stdenv.lib.licenses.gpl3; + maintainers = [ stdenv.lib.maintainers.pombeirp ]; + platforms = stdenv.lib.platforms.darwin; + }; +} diff --git a/scripts/lib/setup/nix/desktop/macos/default.nix b/scripts/lib/setup/nix/desktop/macos/default.nix new file mode 100644 index 0000000000..7b1d6579c5 --- /dev/null +++ b/scripts/lib/setup/nix/desktop/macos/default.nix @@ -0,0 +1,12 @@ +{ stdenv, pkgs }: + +with pkgs; +with stdenv; + +let + baseImage = callPackage ./base-image { }; + +in +{ + buildInputs = [ baseImage ]; +} diff --git a/scripts/lib/setup/nix/desktop/windows/base-image/default.nix b/scripts/lib/setup/nix/desktop/windows/base-image/default.nix new file mode 100644 index 0000000000..8cd883f2f7 --- /dev/null +++ b/scripts/lib/setup/nix/desktop/windows/base-image/default.nix @@ -0,0 +1,40 @@ +{ pkgs, stdenv, fetchurl }: + +with pkgs; + +stdenv.mkDerivation rec { + name = "StatusIm-Windows-base-image"; + version = "20181113"; + + src = + if stdenv.hostPlatform.system == "x86_64-linux" then + fetchurl { + url = "https://desktop-app-files.ams3.digitaloceanspaces.com/${name}_${version}.zip"; + sha256 = "1wrxcss63zlwspmw76k549z72hcycxzd9iw4cdh98l4hs2ayzsk3"; + } + else throw "${name} is not supported on ${stdenv.hostPlatform.system}"; + + nativeBuildInputs = [ unzip ]; + + phases = [ "unpackPhase" "installPhase" ]; + unpackPhase = '' + mkdir -p $out/src + unzip $src -d $out/src + ''; + installPhase = '' + runHook preInstall + + echo $out + ls $out -al + + runHook postInstall + ''; + + meta = { + description = "A base image for Windows Status Desktop release distributions"; + homepage = https://desktop-app-files.ams3.digitaloceanspaces.com/; + license = stdenv.lib.licenses.gpl3; + maintainers = [ stdenv.lib.maintainers.pombeirp ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/scripts/lib/setup/nix/desktop/windows/default.nix b/scripts/lib/setup/nix/desktop/windows/default.nix index ea9cdba738..bd8a10af80 100644 --- a/scripts/lib/setup/nix/desktop/windows/default.nix +++ b/scripts/lib/setup/nix/desktop/windows/default.nix @@ -1,8 +1,12 @@ { stdenv, pkgs }: with pkgs; -with stdenv; +with stdenv; +let + baseImage = callPackage ./base-image { }; + +in { - buildInputs = lib.optional isLinux [ conan nsis ]; + buildInputs = lib.optional isLinux [ conan nsis baseImage ]; } diff --git a/scripts/lib/setup/nix/mobile/default.nix b/scripts/lib/setup/nix/mobile/default.nix index 9e13f4a78c..9f4af3c032 100644 --- a/scripts/lib/setup/nix/mobile/default.nix +++ b/scripts/lib/setup/nix/mobile/default.nix @@ -1,7 +1,7 @@ { stdenv, pkgs, target-os ? "" }: with pkgs; -with stdenv; +with stdenv; let android-ndk = callPackage ./android-ndk { };