diff --git a/derivation.nix b/derivation.nix index d96aa0d304..f48e0246db 100644 --- a/derivation.nix +++ b/derivation.nix @@ -3,42 +3,42 @@ , pkgs ? (import { inherit system config overlays; }) , target-os }: -with pkgs; - let - platform = callPackage ./nix/platform.nix { inherit target-os; }; - # TODO: Try to use stdenv for iOS. The problem is with building iOS as the build is trying to pass parameters to Apple's ld that are meant for GNU's ld (e.g. -dynamiclib) - _stdenv = stdenvNoCC; - statusDesktop = callPackage ./nix/desktop { inherit target-os status-go; stdenv = _stdenv; }; - statusMobile = callPackage ./nix/mobile { inherit target-os config status-go; stdenv = _stdenv; }; - status-go = callPackage ./nix/status-go { inherit target-os; inherit (xcodeenv) composeXcodeWrapper; inherit (statusMobile) xcodewrapperArgs; androidPkgs = statusMobile.androidComposition; }; - nodejs' = nodejs-10_x; - yarn' = yarn.override { nodejs = nodejs'; }; - nodeInputs = import ./nix/global-node-packages/output { - # The remaining dependencies come from Nixpkgs - inherit pkgs; - nodejs = nodejs'; - }; - nodePkgBuildInputs = [ - nodejs' - python27 # for e.g. gyp - yarn' - ] ++ (builtins.attrValues nodeInputs); - selectedSources = - lib.optional platform.targetDesktop statusDesktop ++ - lib.optional platform.targetMobile statusMobile; +let + platform = pkgs.callPackage ./nix/platform.nix { inherit target-os; }; + # TODO: Try to use stdenv for iOS. The problem is with building iOS as the build is trying to pass parameters to Apple's ld that are meant for GNU's ld (e.g. -dynamiclib) + stdenv' = pkgs.stdenvNoCC; + gradle = pkgs.gradle_4_10; + statusDesktop = pkgs.callPackage ./nix/desktop { inherit target-os status-go; inherit (pkgs) darwin; stdenv = stdenv'; }; + statusMobile = pkgs.callPackage ./nix/mobile { inherit target-os config status-go gradle; inherit (pkgs.xcodeenv) composeXcodeWrapper; stdenv = stdenv'; }; + status-go = pkgs.callPackage ./nix/status-go { inherit target-os; inherit (pkgs.xcodeenv) composeXcodeWrapper; inherit (statusMobile) xcodewrapperArgs; androidPkgs = statusMobile.androidComposition; }; + nodejs' = pkgs.nodejs-10_x; + yarn' = pkgs.yarn.override { nodejs = nodejs'; }; + nodeInputs = import ./nix/global-node-packages/output { + # The remaining dependencies come from Nixpkgs + inherit pkgs; + nodejs = nodejs'; + }; + nodePkgBuildInputs = [ + nodejs' + pkgs.python27 # for e.g. gyp + yarn' + ] ++ (builtins.attrValues nodeInputs); + selectedSources = + stdenv'.lib.optional platform.targetDesktop statusDesktop ++ + stdenv'.lib.optional platform.targetMobile statusMobile; - in _stdenv.mkDerivation rec { - name = "status-react-build-env"; +in with stdenv'; stdenv'.mkDerivation rec { + name = "status-react-build-env"; - buildInputs = with _stdenv; [ - clojure - leiningen - maven - watchman - ] ++ nodePkgBuildInputs - ++ lib.optional isDarwin cocoapods - ++ lib.optional (isDarwin && !platform.targetIOS) clang - ++ lib.optional (!isDarwin) gcc7 - ++ lib.catAttrs "buildInputs" selectedSources; - shellHook = lib.concatStrings (lib.catAttrs "shellHook" selectedSources); - } + buildInputs = with pkgs; [ + clojure + leiningen + maven + watchman + ] ++ nodePkgBuildInputs + ++ lib.optional isDarwin cocoapods + ++ lib.optional (isDarwin && !platform.targetIOS) clang + ++ lib.optional (!isDarwin) gcc7 + ++ lib.catAttrs "buildInputs" selectedSources; + shellHook = lib.concatStrings (lib.catAttrs "shellHook" selectedSources); +} diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 9158c13bfc..80c027c3cf 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -139,6 +139,6 @@ SPEC CHECKSUMS: SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322 yoga: 128daf064cacaede0c3bb27424b6b4c71052e6cd -PODFILE CHECKSUM: 6a6c6a3aad3b4979df3974dc03b0bf305426ce72 +PODFILE CHECKSUM: 1b73a7ab29d939e99e86434864c837afaf55851c COCOAPODS: 1.5.3 diff --git a/nix/desktop/default.nix b/nix/desktop/default.nix index b1cf873c27..8c5cf8f32c 100644 --- a/nix/desktop/default.nix +++ b/nix/desktop/default.nix @@ -1,12 +1,13 @@ -{ stdenv, pkgs, target-os, status-go }: +{ stdenv, callPackage, target-os, + cmake, extra-cmake-modules, file, status-go, + darwin }: -with pkgs; with stdenv; let platform = callPackage ../platform.nix { inherit target-os; }; linuxPlatform = callPackage ./linux { inherit status-go; }; - darwinPlatform = callPackage ./macos { inherit status-go; }; + darwinPlatform = callPackage ./macos { inherit status-go darwin; }; windowsPlatform = callPackage ./windows { }; snoreNotifySources = callPackage ./cmake/snorenotify { }; qtkeychainSources = callPackage ./cmake/qtkeychain { }; diff --git a/nix/desktop/linux/default.nix b/nix/desktop/linux/default.nix index 61f1d65b03..01cbd01ab6 100644 --- a/nix/desktop/linux/default.nix +++ b/nix/desktop/linux/default.nix @@ -1,6 +1,6 @@ -{ stdenv, pkgs, status-go }: +{ stdenv, callPackage, + appimagekit, patchelf, qt5, status-go }: -with pkgs; with stdenv; assert isLinux; diff --git a/nix/desktop/macos/default.nix b/nix/desktop/macos/default.nix index 6b127a84cf..9b380a24ff 100644 --- a/nix/desktop/macos/default.nix +++ b/nix/desktop/macos/default.nix @@ -1,6 +1,6 @@ -{ stdenv, pkgs, status-go }: +{ stdenv, callPackage, + darwin, qt5, status-go }: -with pkgs; with stdenv; with darwin.apple_sdk.frameworks; diff --git a/nix/desktop/windows/default.nix b/nix/desktop/windows/default.nix index 6fb43b2eca..ba1e60c04b 100644 --- a/nix/desktop/windows/default.nix +++ b/nix/desktop/windows/default.nix @@ -1,6 +1,6 @@ -{ stdenv, pkgs }: +{ stdenv, callPackage, + conan, nsis, go }: -with pkgs; with stdenv; assert isLinux; diff --git a/nix/mobile/android.nix b/nix/mobile/android.nix index 81a0ad2524..0726393ab1 100644 --- a/nix/mobile/android.nix +++ b/nix/mobile/android.nix @@ -1,10 +1,9 @@ -{ config, stdenv, pkgs }: +{ config, stdenv, callPackage, + androidenv, openjdk, gradle }: -with pkgs; with stdenv; let - gradle = gradle_4_10; androidComposition = androidenv.composeAndroidPackages { toolsVersion = "26.1.1"; platformToolsVersion = "28.0.2"; @@ -33,7 +32,7 @@ in buildInputs = [ openjdk gradle ]; shellHook = '' export JAVA_HOME="${openjdk}" - export ANDROID_HOME=${licensedAndroidEnv} + export ANDROID_HOME="${licensedAndroidEnv}" export ANDROID_SDK_ROOT="$ANDROID_HOME" export ANDROID_NDK_ROOT="${androidComposition.androidsdk}/libexec/android-sdk/ndk-bundle" export ANDROID_NDK_HOME="$ANDROID_NDK_ROOT" diff --git a/nix/mobile/default.nix b/nix/mobile/default.nix index f5515a7db7..688a01c2fa 100644 --- a/nix/mobile/default.nix +++ b/nix/mobile/default.nix @@ -1,16 +1,15 @@ -{ config, stdenv, pkgs, target-os, status-go }: +{ config, stdenv, callPackage, target-os, + gradle, status-go, composeXcodeWrapper }: -with pkgs; with stdenv; let - gradle = gradle_4_10; - platform = pkgs.callPackage ../platform.nix { inherit target-os; }; + platform = callPackage ../platform.nix { inherit target-os; }; xcodewrapperArgs = { version = "10.1"; }; - xcodeWrapper = xcodeenv.composeXcodeWrapper xcodewrapperArgs; - androidPlatform = callPackage ./android.nix { inherit config; }; + xcodeWrapper = composeXcodeWrapper xcodewrapperArgs; + androidPlatform = callPackage ./android.nix { inherit config gradle; }; selectedSources = [ status-go ] ++ lib.optional platform.targetAndroid androidPlatform; diff --git a/nix/mobile/licensed-android-sdk.nix b/nix/mobile/licensed-android-sdk.nix index 573357ab08..bc453d93dd 100644 --- a/nix/mobile/licensed-android-sdk.nix +++ b/nix/mobile/licensed-android-sdk.nix @@ -1,6 +1,4 @@ -{ config, stdenv, pkgs, androidComposition }: - -with pkgs; +{ config, stdenv, androidComposition }: stdenv.mkDerivation rec { name = "licensed-android-sdk"; diff --git a/nix/status-go/build-desktop-status-go.nix b/nix/status-go/build-desktop-status-go.nix index 109a45f3d8..80107004b8 100644 --- a/nix/status-go/build-desktop-status-go.nix +++ b/nix/status-go/build-desktop-status-go.nix @@ -1,5 +1,6 @@ -{ buildGoPackage, go, xcodeWrapper, pkgs, stdenv, utils }: +{ stdenv, utils, callPackage, + buildGoPackage, go, xcodeWrapper }: { owner, repo, rev, version, goPackagePath, src, host, @@ -11,7 +12,7 @@ with stdenv; let - buildStatusGo = pkgs.callPackage ./build-status-go.nix { inherit buildGoPackage go xcodeWrapper utils; }; + buildStatusGo = callPackage ./build-status-go.nix { inherit buildGoPackage go xcodeWrapper utils; }; args = removeAttrs args' [ "goBuildFlags" "goBuildLdFlags" "outputFileName" "hostSystem" ]; # Remove desktop-only arguments from args buildStatusGoDesktopLib = buildStatusGo (args // { diff --git a/nix/status-go/build-mobile-status-go.nix b/nix/status-go/build-mobile-status-go.nix index 8735c6fd07..44a48b2a1e 100644 --- a/nix/status-go/build-mobile-status-go.nix +++ b/nix/status-go/build-mobile-status-go.nix @@ -1,5 +1,6 @@ -{ buildGoPackage, go, gomobile, openjdk, xcodeWrapper, pkgs, stdenv, utils }: +{ stdenv, utils, callPackage, + buildGoPackage, go, gomobile, openjdk, xcodeWrapper }: { owner, repo, rev, version, goPackagePath, src, host, @@ -11,7 +12,7 @@ with stdenv; let targetConfig = config; - buildStatusGo = pkgs.callPackage ./build-status-go.nix { inherit buildGoPackage go xcodeWrapper utils; }; + buildStatusGo = callPackage ./build-status-go.nix { inherit buildGoPackage go xcodeWrapper utils; }; args = removeAttrs args' [ "config" "goBuildFlags" "goBuildLdFlags" ]; # Remove mobile-only arguments from args buildStatusGoMobileLib = buildStatusGo (args // { diff --git a/nix/status-go/default.nix b/nix/status-go/default.nix index cfa3bb5e36..455686ca87 100644 --- a/nix/status-go/default.nix +++ b/nix/status-go/default.nix @@ -1,13 +1,15 @@ -{ target-os, stdenv, buildGoPackage, go, pkgs, fetchFromGitHub, openjdk, androidPkgs, composeXcodeWrapper, xcodewrapperArgs ? {} }: +{ target-os, stdenv, callPackage, + buildGoPackage, go, fetchFromGitHub, openjdk, + androidPkgs, composeXcodeWrapper, xcodewrapperArgs ? {} }: with stdenv; let - platform = pkgs.callPackage ../platform.nix { inherit target-os; }; - utils = pkgs.callPackage ../utils.nix { inherit xcodeWrapper; }; - gomobile = pkgs.callPackage ./gomobile { inherit (androidPkgs) platform-tools; inherit composeXcodeWrapper xcodewrapperArgs utils; }; - buildStatusGoDesktopLib = pkgs.callPackage ./build-desktop-status-go.nix { inherit buildGoPackage go pkgs xcodeWrapper utils; }; - buildStatusGoMobileLib = pkgs.callPackage ./build-mobile-status-go.nix { inherit buildGoPackage go gomobile pkgs xcodeWrapper utils; }; + platform = callPackage ../platform.nix { inherit target-os; }; + utils = callPackage ../utils.nix { inherit xcodeWrapper; }; + gomobile = callPackage ./gomobile { inherit (androidPkgs) platform-tools; inherit composeXcodeWrapper xcodewrapperArgs utils; }; + buildStatusGoDesktopLib = callPackage ./build-desktop-status-go.nix { inherit buildGoPackage go xcodeWrapper utils; }; + buildStatusGoMobileLib = callPackage ./build-mobile-status-go.nix { inherit buildGoPackage go gomobile xcodeWrapper utils; }; extractStatusGoConfig = f: lib.last (lib.splitString "\n" (lib.fileContents f)); owner = lib.fileContents ../../STATUS_GO_OWNER; version = extractStatusGoConfig ../../STATUS_GO_VERSION; # TODO: Simplify this path search with lib.locateDominatingFile diff --git a/nix/status-go/gomobile/default.nix b/nix/status-go/gomobile/default.nix index a210457e39..09e96a86e6 100644 --- a/nix/status-go/gomobile/default.nix +++ b/nix/status-go/gomobile/default.nix @@ -1,5 +1,5 @@ -{ stdenv, pkgs, utils, buildGoPackage, fetchgit, - glibc, ncurses5, zlib, makeWrapper, patchelf, +{ stdenv, utils, fetchgit, + buildGoPackage, glibc, ncurses5, zlib, makeWrapper, patchelf, platform-tools, composeXcodeWrapper, xcodewrapperArgs ? {} }: diff --git a/scripts/prepare-for-platform.sh b/scripts/prepare-for-platform.sh index 9ce698f5b7..77e14d1f40 100755 --- a/scripts/prepare-for-platform.sh +++ b/scripts/prepare-for-platform.sh @@ -61,8 +61,6 @@ if [ ! -f .babelrc ] || [ $(readlink .babelrc) != "${PLATFORM_FOLDER}/.babelrc" ln -sf ${PLATFORM_FOLDER}/metro.config.js metro.config.js fi -rm -rf /home/jenkins/.cache/yarn/v4/.tmp/6ec8ff0e65cf4f48c50d7472fa1f10ca -rm -rf /Users/jenkins/Library/Caches/Yarn/v4/.tmp/6ec8ff0e65cf4f48c50d7472fa1f10ca yarn install --frozen-lockfile case $1 in