nix: reafactoring of status-go builds
Changes: - Fixed `nix/status-go/desktop` builds - Dropped nimbus wrapper for `status-go` for now - Split `status-go` builds into subfolders: `mobile`, `desktop` - Fixed shells for desktop builds: `linux`,`macos`,`windows` - Added `make status-go-*` targets for building them - Moved source management to `nix/status-go/source.nix` - Moved `nix/status-go/build.nix` into `nix/status-go/mobile` - Moved `nix/desktop/cmake/qtkeychain` to `nix/pkgs/qtkeychain-src` - Moved `nix/desktop/linux/linuxdeployqt` to `nix/pkgs` - Moved `nix/desktop/linux/appimagekit` to `nix/pkgs` - Dropped `nix/tools/mkShell.nix` since it did almost nothing - Dropped `nix/desktop/cmake/snorenotify` since it's broken - Moved setup from `nix/tools/mkShell.nix` to `nix/shells.nix` - Simplified `nix/mobile/ios/status-go-shell.nix` - Simplified `nix/status-go/default.nix` - Updated the `nix/DETAILS.md` and `nix/README.md` - Moved known issues to `nix/KNOWN_ISSUES.md` - Improved output of `nix/scripts/build.sh` Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
3116b04a34
commit
42fb40476c
17
Makefile
17
Makefile
|
@ -201,6 +201,22 @@ jsbundle-ios: export BUILD_ENV ?= prod
|
||||||
jsbundle-ios: ##@jsbundle Compile JavaScript and Clojure into index.ios.js
|
jsbundle-ios: ##@jsbundle Compile JavaScript and Clojure into index.ios.js
|
||||||
yarn shadow-cljs release ios
|
yarn shadow-cljs release ios
|
||||||
|
|
||||||
|
#--------------
|
||||||
|
# status-go lib
|
||||||
|
# -------------
|
||||||
|
|
||||||
|
status-go-desktop: SHELL := /bin/sh
|
||||||
|
status-go-desktop: ##@status-go Compile status-go for desktop app
|
||||||
|
nix/scripts/build.sh targets.status-go.desktop
|
||||||
|
|
||||||
|
status-go-android: SHELL := /bin/sh
|
||||||
|
status-go-android: ##@status-go Compile status-go for Android app
|
||||||
|
nix/scripts/build.sh targets.status-go.mobile.android
|
||||||
|
|
||||||
|
status-go-ios: SHELL := /bin/sh
|
||||||
|
status-go-ios: ##@status-go Compile status-go for iOS app
|
||||||
|
nix/scripts/build.sh targets.status-go.mobile.ios
|
||||||
|
|
||||||
#--------------
|
#--------------
|
||||||
# Clojure REPL
|
# Clojure REPL
|
||||||
# -------------
|
# -------------
|
||||||
|
@ -259,7 +275,6 @@ endif
|
||||||
|
|
||||||
lint: export TARGET := clojure
|
lint: export TARGET := clojure
|
||||||
lint: ##@test Run code style checks
|
lint: ##@test Run code style checks
|
||||||
# yarn clj-kondo --confg .clj-kondo/config.edn --lint src
|
|
||||||
clojure -Sdeps '{:deps {cljfmt {:mvn/version "0.6.7"}}}' \
|
clojure -Sdeps '{:deps {cljfmt {:mvn/version "0.6.7"}}}' \
|
||||||
-m cljfmt.main check src \
|
-m cljfmt.main check src \
|
||||||
--indents indentation.edn
|
--indents indentation.edn
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# for passing build options, see nix/README.md
|
# for passing build options, see nix/README.md
|
||||||
{ config ? { status-im = { build-type = ""; }; } }:
|
{ config ? { status-im = { }; } }:
|
||||||
|
|
||||||
let
|
let
|
||||||
main = import ./nix/default.nix { inherit config; };
|
main = import ./nix/default.nix { inherit config; };
|
||||||
in {
|
in {
|
||||||
# this is where the --attr argument selects the shell or target
|
# this is where the --attr argument selects the shell or target
|
||||||
inherit (main) pkgs targets shells;
|
inherit (main) pkgs targets shells;
|
||||||
|
inherit config;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ There are four main folders in the `nix` directory:
|
||||||
* `nix/scripts` - Bash scripts for easier usage of Nix
|
* `nix/scripts` - Bash scripts for easier usage of Nix
|
||||||
* `nix/pkgs` - Packages we add to or modify in `nixpkgs`
|
* `nix/pkgs` - Packages we add to or modify in `nixpkgs`
|
||||||
* `nix/deps` - Project dependencies managed by Nix
|
* `nix/deps` - Project dependencies managed by Nix
|
||||||
|
* `nix/lib` - Our tools we merge into `pkgs.lib`
|
||||||
* `nix/tools` - Various tools used by our derivations and shells
|
* `nix/tools` - Various tools used by our derivations and shells
|
||||||
* `nix/status-go` - Derivations for building [`status-go`](https://github.com/status-im/status-go) repo
|
* `nix/status-go` - Derivations for building [`status-go`](https://github.com/status-im/status-go) repo
|
||||||
|
|
||||||
|
@ -16,12 +17,15 @@ There are four main folders in the `nix` directory:
|
||||||
|
|
||||||
There are a few main files that define the whole build environment:
|
There are a few main files that define the whole build environment:
|
||||||
|
|
||||||
|
* `nix/nix.conf` - Binary cache configuration
|
||||||
* `nix/default.nix` - Entrypoint for both shells and targets
|
* `nix/default.nix` - Entrypoint for both shells and targets
|
||||||
* `nix/shells.nix` - Definition of Nix shells used in builds
|
* `nix/shells.nix` - Definition of Nix shells used in builds
|
||||||
* `nix/targets.nix` - Hierarchy of main build targets
|
* `nix/targets.nix` - Hierarchy of main build targets
|
||||||
* `nix/pkgs.nix` - Definition of a custom `nixpkgs` repo
|
* `nix/pkgs.nix` - Definition of a custom `nixpkgs` repo
|
||||||
* `nix/overlay.nix` - Overrides for `nixpkgs`, custom packages
|
* `nix/overlay.nix` - Overrides for `nixpkgs`, custom packages
|
||||||
|
|
||||||
|
The `default.nix` and `shell.nix` files at th repo root are just a gateway into the `nix` subfolder.
|
||||||
|
|
||||||
# Start
|
# Start
|
||||||
|
|
||||||
The starting point for using our Nix shells and targets is the [`default.nix`](/default.nix) file.
|
The starting point for using our Nix shells and targets is the [`default.nix`](/default.nix) file.
|
||||||
|
@ -49,11 +53,11 @@ nix-build \
|
||||||
--show-trace \
|
--show-trace \
|
||||||
--attr targets.mobile.android.release \
|
--attr targets.mobile.android.release \
|
||||||
--argstr secrets-file '/tmp/tmp-status-react-559a3a441/tmp.xAnrPuNtAP' \
|
--argstr secrets-file '/tmp/tmp-status-react-559a3a441/tmp.xAnrPuNtAP' \
|
||||||
--option extra-sandbox-paths '/home/sochan/.gradle/status-im.keystore /tmp/tmp-status-react-559a3a441/tmp.xAnrPuNtAP' \
|
--option extra-sandbox-paths '/home/joe/.gradle/status-im.keystore /tmp/tmp-status-react-559a3a441/tmp.xAnrPuNtAP' \
|
||||||
--arg config '{ \
|
--arg config '{ \
|
||||||
status-im.build-type="nightly";
|
status-im.build-type="nightly";
|
||||||
status-im.build-number="2020022418";
|
status-im.build-number="2020022418";
|
||||||
status-im.android.keystore-file="/home/sochan/.gradle/status-im.keystore";
|
status-im.android.keystore-path="/home/joe/.gradle/status-im.keystore";
|
||||||
status-im.android.abi-split="false";
|
status-im.android.abi-split="false";
|
||||||
status-im.android.abi-include="armeabi-v7a;arm64-v8a;x86";
|
status-im.android.abi-include="armeabi-v7a;arm64-v8a;x86";
|
||||||
}' \
|
}' \
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
# Known Issues
|
||||||
|
|
||||||
|
## MacOS 10.15 "Catalina"
|
||||||
|
|
||||||
|
There is an unsolved issue with the root(`/`) file system in `10.15` being read-only:
|
||||||
|
https://github.com/NixOS/nix/issues/2925
|
||||||
|
|
||||||
|
Our current recommended workaround is putting `/nix` under `/opt/nix` and symlinking it via `/etc/synthetic.conf`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo mkdir /opt/nix
|
||||||
|
sudo chown ${USER} /opt/nix
|
||||||
|
sudo sh -c "echo 'nix\t/opt/nix' >> /etc/synthetic.conf"
|
||||||
|
reboot
|
||||||
|
```
|
||||||
|
|
||||||
|
After the system reboots you should see the `/nix` symlink in place:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
% ls -l /nix
|
||||||
|
lrwxr-xr-x 1 root wheel 8 Oct 11 13:53 /nix -> /opt/nix
|
||||||
|
```
|
||||||
|
|
||||||
|
In order to be able to use Nix with a symlinked `/nix` you need to include this in your shell:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export NIX_IGNORE_SYMLINK_STORE=1
|
||||||
|
```
|
||||||
|
|
||||||
|
Add it to your `.bashrc` or any other shell config file.
|
||||||
|
|
||||||
|
__NOTE__: Your old `/nix` directory will end up in `/Users/Shared/Relocated Items/Security/nix` after OS upgrade.
|
||||||
|
|
||||||
|
## Cache Downloads Timing Out
|
||||||
|
|
||||||
|
If copying from Nix Cache times out you can adjust the timeout by changing [`nix/nix.conf`](/nix/nix.conf):
|
||||||
|
```conf
|
||||||
|
stalled-download-timeout = 9001
|
||||||
|
```
|
||||||
|
|
||||||
|
## `extra-sandbox-paths` Is a Restricted Setting
|
||||||
|
|
||||||
|
When building Android on NixOS you might encounter the following error:
|
||||||
|
```
|
||||||
|
ignoring the user-specified setting 'extra-sandbox-paths', because it is a restricted setting and you are not a trusted user
|
||||||
|
```
|
||||||
|
You can mitigate this by setting the [`nix.trustedUsers`](https://nixos.org/nixos/options.html#nix.trustedusers) property.
|
|
@ -10,19 +10,23 @@ __NOTE:__ If you are in Asia you might want to add the `https://nix-cache-cn.sta
|
||||||
|
|
||||||
## Build arguments
|
## Build arguments
|
||||||
|
|
||||||
We leverage the standard nixpkgs `config` argument for our own parameterization of the builds (e.g. to pass a build number or build type). Here is a sample structure of the `config` attribute set:
|
We leverage the standard nixpkgs `config` argument for our own parameterization of the builds (e.g. to pass a build number or build type).
|
||||||
|
|
||||||
|
Here is a sample structure of the `config` attribute set:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
config = {
|
config = {
|
||||||
status-im = {
|
status-im = {
|
||||||
ci = "1"; # This flag is present when running in a CI environment
|
|
||||||
build-type = "pr"; # Build type (influences which .env file gets used for feature flags)
|
build-type = "pr"; # Build type (influences which .env file gets used for feature flags)
|
||||||
status-go = {
|
build-number = 9999; # Used for versionCode and CFBundleVersion in Android and iOS respectively
|
||||||
src-override = "$GOPATH/src/github.com/status-im/status-go";
|
android = {
|
||||||
};
|
|
||||||
status-react = {
|
|
||||||
build-number = "9999"; # Build number to be assigned to the app bundle
|
|
||||||
gradle-opts = ""; # Gradle options passed for Android builds
|
gradle-opts = ""; # Gradle options passed for Android builds
|
||||||
|
keystore-path = ""; # Path to keystore for signing the APK
|
||||||
|
abi-split = false; # If APKs should be split based on architectures
|
||||||
|
abi-include = "x86"; # Android architectures to build for
|
||||||
|
};
|
||||||
|
status-go = {
|
||||||
|
src-override = "$HOME/my/source/status-go"; # local source override
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -46,71 +50,14 @@ For valid values you can check the [`nix/shells.nix`](/nix/shells.nix) file.
|
||||||
|
|
||||||
## Using a local status-go repository
|
## Using a local status-go repository
|
||||||
|
|
||||||
If you need to use a locally checked-out status-go repository as a dependency of status-react, you can achieve that by defining the `STATUS_GO_SRC_OVERRIDE`
|
If you need to use a locally checked-out status-go repository, you can achieve that by defining the `STATUS_GO_SRC_OVERRIDE`
|
||||||
environment variable.
|
environment variable:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
export STATUS_GO_SRC_OVERRIDE=$GOPATH/src/github.com/status-im/status-go
|
export STATUS_GO_SRC_OVERRIDE=$GOPATH/src/github.com/status-im/status-go
|
||||||
# Any command that you run from now on
|
|
||||||
# will use the specified status-go location
|
|
||||||
make release-android
|
make release-android
|
||||||
```
|
```
|
||||||
|
|
||||||
or for a one-off build:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
make release-android STATUS_GO_SRC_OVERRIDE=$GOPATH/src/github.com/status-im/status-go
|
|
||||||
```
|
|
||||||
|
|
||||||
## Using a local Nimbus repository
|
|
||||||
|
|
||||||
If you need to use a locally checked-out Nimbus repository as a dependency of status-go, you can achieve that by defining the `NIMBUS_SRC_OVERRIDE`
|
|
||||||
environment variable, in the same way as the previous point for local status-go repositories.
|
|
||||||
|
|
||||||
## Known Issues
|
## Known Issues
|
||||||
|
|
||||||
### MacOS 10.15 "Catalina"
|
See [`KNOWN_ISSUES.md`](./KNOWN_ISSUES.md).
|
||||||
|
|
||||||
There is an unsolved issue with the root(`/`) file system in `10.15` being read-only:
|
|
||||||
https://github.com/NixOS/nix/issues/2925
|
|
||||||
|
|
||||||
Our current recommended workaround is putting `/nix` under `/opt/nix` and symlinking it via `/etc/synthetic.conf`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo mkdir /opt/nix
|
|
||||||
sudo chown ${USER} /opt/nix
|
|
||||||
sudo sh -c "echo 'nix\t/opt/nix' >> /etc/synthetic.conf"
|
|
||||||
reboot
|
|
||||||
```
|
|
||||||
|
|
||||||
After the system reboots you should see the `/nix` symlink in place:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
% ls -l /nix
|
|
||||||
lrwxr-xr-x 1 root wheel 8 Oct 11 13:53 /nix -> /opt/nix
|
|
||||||
```
|
|
||||||
|
|
||||||
In order to be able to use Nix with a symlinked `/nix` you need to include this in your shell:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export NIX_IGNORE_SYMLINK_STORE=1
|
|
||||||
```
|
|
||||||
|
|
||||||
Add it to your `.bashrc` or any other shell config file.
|
|
||||||
|
|
||||||
__NOTE__: Your old `/nix` directory will end up in `/Users/Shared/Relocated Items/Security/nix` after OS upgrade.
|
|
||||||
|
|
||||||
### Cache Downloads Timing Out
|
|
||||||
|
|
||||||
If copying from Nix Cache times out you can adjust the timeout by changing [`nix/nix.conf`](/nix/nix.conf):
|
|
||||||
```conf
|
|
||||||
stalled-download-timeout = 9001
|
|
||||||
```
|
|
||||||
|
|
||||||
### `extra-sandbox-paths` Is a Restricted Setting
|
|
||||||
|
|
||||||
When building Android on NixOS you might encounter the following error:
|
|
||||||
```
|
|
||||||
ignoring the user-specified setting 'extra-sandbox-paths', because it is a restricted setting and you are not a trusted user
|
|
||||||
```
|
|
||||||
You can mitigate this by setting the [`nix.trustedUsers`](https://nixos.org/nixos/options.html#nix.trustedusers) property.
|
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
{ pkgs, stdenv, fetchFromGitHub }:
|
|
||||||
|
|
||||||
let
|
|
||||||
version = "0.8.90";
|
|
||||||
rev = "d3c606c55adf8c2c2747556055652b3469f6c4c2"; # This revision will get used in https://github.com/status-im/react-native-keychain/blob/master/desktop/CMakeLists.txt#L45
|
|
||||||
sha256 = "1gqw3g0j46aswncm8fgy419lp1fp2y2nild82hs18xra5albvf3i";
|
|
||||||
package = stdenv.mkDerivation {
|
|
||||||
name = "qtkeychain-patched-source";
|
|
||||||
version = "${version}-${stdenv.lib.strings.substring 0 7 rev}";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
inherit rev sha256;
|
|
||||||
owner = "status-im";
|
|
||||||
repo = "qtkeychain";
|
|
||||||
name = "qtkeychain-source-${version}";
|
|
||||||
};
|
|
||||||
|
|
||||||
phases = [ "unpackPhase" ];
|
|
||||||
unpackPhase = ''
|
|
||||||
mkdir -p $out/src
|
|
||||||
cp -r $src/* $out/src/
|
|
||||||
substituteInPlace $out/src/CMakeLists.txt \
|
|
||||||
--replace "cmake_minimum_required(VERSION 2.8.11)" "cmake_minimum_required(VERSION 3.12.1)" \
|
|
||||||
--replace "project(qtkeychain)" "project(qtkeychain VERSION ${version})" \
|
|
||||||
--replace "set(QTKEYCHAIN_VERSION 0.8.90)" "set(QTKEYCHAIN_VERSION ${version})" \
|
|
||||||
--replace "{QTKEYCHAIN_VERSION}\" VARIABLE_PREFIX SNORE" "QTKEYCHAIN_VERSION VARIABLE_PREFIX SNORE" \
|
|
||||||
--replace "\"\$QTKEYCHAIN_VERSION" qtkeychain
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
|
||||||
description = "Patched sources for qtkeychain, a platform-independent Qt API for storing passwords securely";
|
|
||||||
homepage = https://github.com/status-im/qtkeychain;
|
|
||||||
license = licenses.bsd3;
|
|
||||||
maintainers = [ maintainers.pombeirp ];
|
|
||||||
platforms = with platforms; darwin ++ linux;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
in package // {
|
|
||||||
shellHook = (package.shellHook or "") + ''
|
|
||||||
export QTKEYCHAIN_SOURCES="${package}/src"
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
{ pkgs, stdenv, fetchFromGitHub }:
|
|
||||||
|
|
||||||
let
|
|
||||||
version = "0.7.1";
|
|
||||||
rev = "9d54904e4896ab6c3c3a52f97381e5948b455970"; # This revision will get used in modules/react-native-desktop-notification/desktop/CMakeLists.txt#L71
|
|
||||||
sha256 = "0ix1qgx877nw9mlbbqsgkis4phkkf4ax2ambziy2w48hg6ai0x4d";
|
|
||||||
package = stdenv.mkDerivation {
|
|
||||||
name = "snorenotify-patched-source";
|
|
||||||
version = "${version}-${stdenv.lib.strings.substring 0 7 rev}";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
inherit rev sha256;
|
|
||||||
owner = "status-im";
|
|
||||||
repo = "snorenotify";
|
|
||||||
name = "snorenotify-source-${version}";
|
|
||||||
};
|
|
||||||
|
|
||||||
phases = [ "unpackPhase" ];
|
|
||||||
unpackPhase =
|
|
||||||
let
|
|
||||||
inherit (stdenv.lib) versions;
|
|
||||||
in ''
|
|
||||||
mkdir -p $out/src
|
|
||||||
cp -r $src/* $out/src/
|
|
||||||
substituteInPlace $out/src/CMakeLists.txt \
|
|
||||||
--replace "cmake_minimum_required( VERSION 2.8.12 )" "" \
|
|
||||||
--replace "project( SnoreNotify )" "cmake_minimum_required( VERSION 3.12.1 )
|
|
||||||
project( SnoreNotify VERSION ${version} )" \
|
|
||||||
--replace "set(SNORE_VERSION_MAJOR 0)" "set(SNORE_VERSION_MAJOR ${versions.major version} )" \
|
|
||||||
--replace "set(SNORE_VERSION_MINOR 7)" "set(SNORE_VERSION_MINOR ${versions.minor version} )" \
|
|
||||||
--replace "set(SNORE_VERSION_PATCH 1)" "set(SNORE_VERSION_PATCH ${versions.patch version} )"
|
|
||||||
substituteInPlace $out/src/src/libsnore/CMakeLists.txt \
|
|
||||||
--replace "{SNORE_VERSION_MAJOR}" "SNORE_VERSION_MAJOR" \
|
|
||||||
--replace "{SNORE_VERSION_MINOR}" "SNORE_VERSION_MINOR" \
|
|
||||||
--replace "{SNORE_VERSION_PATCH}" "SNORE_VERSION_PATCH" \
|
|
||||||
--replace "ecm_setup_version(\"\$SNORE_VERSION_MAJOR.\$SNORE_VERSION_MINOR.\$SNORE_VERSION_PATCH\"" "ecm_setup_version(SnoreNotify"
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
description = "Patched sources for Snorenotify, a multi platform Qt notification framework. Using a plugin system it is possible to create notifications with many different notification systems on Windows, Mac OS and Unix and mobile Devices";
|
|
||||||
homepage = https://github.com/status-im/snorenotify;
|
|
||||||
license = stdenv.lib.licenses.lgpl3;
|
|
||||||
maintainers = with stdenv.lib.maintainers; [ pombeirp ];
|
|
||||||
platforms = with stdenv.lib.platforms; darwin ++ linux;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
in package // {
|
|
||||||
shellHook = (package.shellHook or "") + ''
|
|
||||||
export SNORENOTIFY_SOURCES="${package}/src"
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,39 +1,49 @@
|
||||||
{ stdenv, mkShell, callPackage, status-go,
|
{ stdenv, lib, pkgs, mkShell, callPackage
|
||||||
cmake, extra-cmake-modules, file, moreutils, go, darwin, nodejs }:
|
, status-go, qtkeychain-src }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (stdenv.lib) catAttrs concatStrings optional unique;
|
inherit (stdenv) isLinux isDarwin;
|
||||||
|
inherit (lib) mapAttrs catAttrs optional unique mergeSh;
|
||||||
|
|
||||||
baseImageFactory = callPackage ./base-image { inherit stdenv; };
|
# utilities
|
||||||
snoreNotifySources = callPackage ./cmake/snorenotify { };
|
baseImageFactory = callPackage ./base-image { };
|
||||||
qtkeychainSources = callPackage ./cmake/qtkeychain { };
|
|
||||||
|
|
||||||
# main targets
|
# main targets
|
||||||
linux = callPackage ./linux { inherit stdenv status-go baseImageFactory; };
|
linux = callPackage ./linux { inherit status-go baseImageFactory; };
|
||||||
macos = callPackage ./macos { inherit stdenv status-go darwin baseImageFactory; };
|
macos = callPackage ./macos { inherit status-go baseImageFactory; };
|
||||||
windows = callPackage ./windows { inherit stdenv go baseImageFactory; };
|
windows = callPackage ./windows { inherit baseImageFactory; };
|
||||||
|
|
||||||
selectedSources =
|
selectedSources =
|
||||||
optional stdenv.isLinux linux ++
|
optional isLinux linux ++
|
||||||
optional stdenv.isLinux windows ++
|
optional isLinux windows ++
|
||||||
optional stdenv.isDarwin macos;
|
optional isDarwin macos;
|
||||||
|
|
||||||
in rec {
|
# default shell for desktop builds
|
||||||
inherit linux macos windows;
|
default = mkShell {
|
||||||
|
buildInputs = with pkgs; unique ([
|
||||||
buildInputs = unique ([
|
file moreutils cmake
|
||||||
cmake
|
|
||||||
extra-cmake-modules
|
extra-cmake-modules
|
||||||
file
|
qtkeychain-src
|
||||||
moreutils
|
] ++ (catAttrs "buildInputs" selectedSources));
|
||||||
snoreNotifySources
|
|
||||||
qtkeychainSources
|
|
||||||
] ++ catAttrs "buildInputs" selectedSources);
|
|
||||||
|
|
||||||
shell = mkShell {
|
inputsFrom = [ status-go.desktop ]
|
||||||
inherit buildInputs;
|
++ (catAttrs "shell" selectedSources);
|
||||||
shellHook = concatStrings (catAttrs "shellHook" (
|
|
||||||
selectedSources ++ [ snoreNotifySources qtkeychainSources ]
|
# These variables are used by the Status Desktop CMake build script in:
|
||||||
));
|
# - modules/react-native-status/desktop/CMakeLists.txt
|
||||||
|
shellHook = ''
|
||||||
|
export STATUS_GO_DESKTOP_INCLUDEDIR=${status-go.desktop}/include
|
||||||
|
export STATUS_GO_DESKTOP_LIBDIR=${status-go.desktop}/lib
|
||||||
|
# QT Keychain library sources
|
||||||
|
export QTKEYCHAIN_SOURCES="${qtkeychain-src}/src"
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# for merging default shell
|
||||||
|
mergeDefaultShell = (key: val: { shell = mergeSh default [ val.shell ]; });
|
||||||
|
|
||||||
|
in {
|
||||||
|
shell = default;
|
||||||
}
|
}
|
||||||
|
# merge default shell with platform sub-shells
|
||||||
|
// mapAttrs mergeDefaultShell { inherit linux windows macos; }
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
{ stdenv, mkShell, callPackage,
|
{ lib, stdenv, mkShell, callPackage
|
||||||
appimagekit, patchelf, qt5, status-go, baseImageFactory }:
|
# pkgs
|
||||||
|
, appimagekit, linuxdeployqt, patchelf, qt5custom
|
||||||
|
# custom arguments
|
||||||
|
, status-go, baseImageFactory }:
|
||||||
|
|
||||||
with stdenv;
|
assert lib.assertMsg stdenv.isLinux "Building Linux app can work only on Linux!";
|
||||||
|
|
||||||
assert isLinux;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) concatStrings catAttrs;
|
inherit (lib) concatStrings catAttrs;
|
||||||
baseImage = baseImageFactory "linux";
|
baseImage = baseImageFactory "linux";
|
||||||
appimagekit = callPackage ./appimagekit { };
|
|
||||||
linuxdeployqt = callPackage ./linuxdeployqt { inherit appimagekit; };
|
|
||||||
|
|
||||||
in rec {
|
in rec {
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
appimagekit
|
appimagekit
|
||||||
linuxdeployqt
|
linuxdeployqt
|
||||||
patchelf
|
patchelf
|
||||||
qt5.full
|
qt5custom
|
||||||
] ++ status-go.buildInputs;
|
];
|
||||||
|
|
||||||
shell = mkShell {
|
shell = mkShell {
|
||||||
inherit buildInputs;
|
inherit buildInputs;
|
||||||
shellHook = concatStrings (catAttrs "shellHook" [ baseImage status-go ]) + ''
|
inputsFrom = [ baseImage status-go ];
|
||||||
export QT_PATH="${qt5.full}"
|
shellHook = ''
|
||||||
export QT_BASEBIN_PATH="${qt5.qtbase.bin}"
|
export QT_PATH="${qt5custom}"
|
||||||
export PATH="${qt5.full}/bin:$PATH"
|
export QT_BASEBIN_PATH="${qt5custom}/bin"
|
||||||
|
export PATH="$QT_BASEBIN_PATH:$PATH"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
{ stdenv, lib, callPackage, mkShell,
|
{ stdenv, lib, callPackage, mkShell,
|
||||||
gnupg22, darwin, qt5, status-go, baseImageFactory }:
|
gnupg22, darwin, qt5custom, status-go, baseImageFactory }:
|
||||||
|
|
||||||
with darwin.apple_sdk.frameworks;
|
assert lib.assertMsg stdenv.isDarwin "Building MacOS app can work only on MacOS!";
|
||||||
|
|
||||||
assert stdenv.isDarwin;
|
|
||||||
let
|
let
|
||||||
inherit (lib) concatStrings catAttrs;
|
inherit (lib) concatStrings catAttrs;
|
||||||
|
inherit (darwin.apple_sdk.frameworks)
|
||||||
|
AppKit Cocoa Foundation OpenGL CoreFoundation;
|
||||||
|
|
||||||
baseImage = baseImageFactory "macos";
|
baseImage = baseImageFactory "macos";
|
||||||
|
|
||||||
in rec {
|
in {
|
||||||
buildInputs = [
|
|
||||||
gnupg22
|
|
||||||
baseImage
|
|
||||||
qt5.full
|
|
||||||
AppKit
|
|
||||||
Cocoa
|
|
||||||
darwin.cf-private
|
|
||||||
Foundation
|
|
||||||
OpenGL
|
|
||||||
] ++ status-go.buildInputs;
|
|
||||||
|
|
||||||
shell = mkShell {
|
shell = mkShell {
|
||||||
inherit buildInputs;
|
buildInputs = [
|
||||||
shellHook = baseImage.shellHook + ''
|
gnupg22 baseImage qt5custom
|
||||||
|
darwin.cf-private
|
||||||
|
AppKit Cocoa Foundation OpenGL
|
||||||
|
];
|
||||||
|
|
||||||
|
inputsFrom = [
|
||||||
|
status-go baseImage
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
export NIX_TARGET_LDFLAGS="-F${CoreFoundation}/Library/Frameworks -framework CoreFoundation $NIX_TARGET_LDFLAGS"
|
export NIX_TARGET_LDFLAGS="-F${CoreFoundation}/Library/Frameworks -framework CoreFoundation $NIX_TARGET_LDFLAGS"
|
||||||
export QT_PATH="${qt5.full}"
|
export QT_PATH="${qt5custom}"
|
||||||
export QT_BASEBIN_PATH="${qt5.qtbase.bin}"
|
export QT_BASEBIN_PATH="${qt5custom}/bin"
|
||||||
export PATH="${qt5.full}/bin:$PATH"
|
export PATH="$QT_BASEBIN_PATH/bin:$PATH"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{ stdenv, mkShell, conan, nsis, go, baseImageFactory }:
|
{ stdenv, lib, mkShell, conan, nsis, go, baseImageFactory }:
|
||||||
|
|
||||||
assert stdenv.isLinux;
|
assert lib.assertMsg stdenv.isLinux "Building Windows app can work only on Linux!";
|
||||||
|
|
||||||
let
|
let
|
||||||
baseImage = baseImageFactory "windows";
|
baseImage = baseImageFactory "windows";
|
||||||
|
|
||||||
in rec {
|
in rec {
|
||||||
buildInputs = stdenv.lib.optionals stdenv.isLinux [
|
buildInputs = lib.optionals stdenv.isLinux [
|
||||||
conan
|
conan
|
||||||
nsis
|
nsis
|
||||||
baseImage
|
baseImage
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{ lib, config }:
|
||||||
|
|
||||||
|
{
|
||||||
|
getConfig = import ./getConfig.nix { inherit lib config; };
|
||||||
|
mkFilter = import ./mkFilter.nix { inherit lib; };
|
||||||
|
mergeSh = import ./mergeSh.nix { inherit lib; };
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
#
|
||||||
|
# helper for getting status-im config values in a safe way
|
||||||
|
#
|
||||||
|
|
||||||
|
{ lib, config }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib) splitString attrByPath;
|
||||||
|
in
|
||||||
|
name: default:
|
||||||
|
let path = [ "status-im" ] ++ (splitString "." name);
|
||||||
|
in attrByPath path default config
|
|
@ -1,10 +1,10 @@
|
||||||
{ lib }:
|
|
||||||
|
|
||||||
# This Nix expression allows filtering a local directory by
|
# This Nix expression allows filtering a local directory by
|
||||||
# specifying dirRootsToInclude, dirsToExclude and filesToInclude.
|
# specifying dirRootsToInclude, dirsToExclude and filesToInclude.
|
||||||
# It also filters out symlinks to result folders created by nix-build,
|
# It also filters out symlinks to result folders created by nix-build,
|
||||||
# as well as backup/swap/generated files.
|
# as well as backup/swap/generated files.
|
||||||
|
|
||||||
|
{ lib }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
any range flatten length sublist cleanSourceFilter
|
any range flatten length sublist cleanSourceFilter
|
|
@ -50,9 +50,5 @@ in {
|
||||||
"${mavenAndNpmDeps.drv}/project"
|
"${mavenAndNpmDeps.drv}/project"
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
[ status-go.shell mavenAndNpmDeps.shell androidShell ];
|
[ mavenAndNpmDeps.shell androidShell ];
|
||||||
|
|
||||||
env = {
|
|
||||||
shell = androidShell;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
{ stdenv, lib, config, callPackage, bash, file, gnumake, watchmanFactory, gradle
|
{ stdenv, lib, config, callPackage,
|
||||||
, androidPkgs, mavenAndNpmDeps, nodejs, openjdk, jsbundle, status-go, unzip, zlib }:
|
bash, file, gnumake, watchmanFactory, gradle,
|
||||||
|
androidPkgs, mavenAndNpmDeps,
|
||||||
|
nodejs, openjdk, jsbundle, status-go, unzip, zlib }:
|
||||||
|
|
||||||
{
|
{
|
||||||
buildEnv ? "prod", # Value for BUILD_ENV checked by Clojure code at compile time
|
buildEnv ? "prod", # Value for BUILD_ENV checked by Clojure code at compile time
|
||||||
|
@ -10,26 +12,20 @@
|
||||||
assert (lib.stringLength watchmanSockPath) > 0 -> stdenv.isDarwin;
|
assert (lib.stringLength watchmanSockPath) > 0 -> stdenv.isDarwin;
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib) toLower optionalString getConfig;
|
||||||
toLower splitString optionalString
|
|
||||||
attrByPath hasAttrByPath optionalAttrs;
|
|
||||||
|
|
||||||
# helper for getting config values
|
|
||||||
safeGetConfig = name: default:
|
|
||||||
let path = [ "status-im" ] ++ (splitString "." name);
|
|
||||||
in attrByPath path default config;
|
|
||||||
|
|
||||||
# custom env variables derived from config
|
# custom env variables derived from config
|
||||||
env = {
|
env = {
|
||||||
ANDROID_ABI_SPLIT = safeGetConfig "android.abi-split" false;
|
ANDROID_ABI_SPLIT = getConfig "android.abi-split" "false";
|
||||||
ANDROID_ABI_INCLUDE = safeGetConfig "android.abi-include" "armeabi-v7a;arm64-v8a;x86";
|
ANDROID_ABI_INCLUDE = getConfig "android.abi-include" "armeabi-v7a;arm64-v8a;x86";
|
||||||
STATUS_GO_SRC_OVERRIDE = safeGetConfig "nimbus.src-override" null;
|
STATUS_GO_SRC_OVERRIDE = getConfig "nimbus.src-override" null;
|
||||||
};
|
};
|
||||||
|
|
||||||
buildType = safeGetConfig "build-type" "prod";
|
buildType = getConfig "build-type" "prod";
|
||||||
buildNumber = safeGetConfig "build-number" "9999";
|
buildNumber = getConfig "build-number" 9999;
|
||||||
gradleOpts = safeGetConfig "android.gradle-opts" "";
|
gradleOpts = getConfig "android.gradle-opts" null;
|
||||||
keystorePath = safeGetConfig "android.keystore-path" "";
|
keystorePath = getConfig "android.keystore-path" null;
|
||||||
|
|
||||||
# Keep the same keystore path for determinism
|
# Keep the same keystore path for determinism
|
||||||
keystoreLocal = "${gradleHome}/status-im.keystore";
|
keystoreLocal = "${gradleHome}/status-im.keystore";
|
||||||
|
|
||||||
|
@ -90,7 +86,7 @@ in stdenv.mkDerivation rec {
|
||||||
|
|
||||||
runHook postUnpack
|
runHook postUnpack
|
||||||
'';
|
'';
|
||||||
postUnpack = assert lib.assertMsg (keystorePath != "") "keystore-file has to be set!"; ''
|
postUnpack = assert lib.assertMsg (keystorePath != null) "keystore-file has to be set!"; ''
|
||||||
mkdir -p ${gradleHome}
|
mkdir -p ${gradleHome}
|
||||||
|
|
||||||
# WARNING: Renaming the keystore will cause 'Keystore was tampered with' error
|
# WARNING: Renaming the keystore will cause 'Keystore was tampered with' error
|
||||||
|
@ -123,14 +119,14 @@ in stdenv.mkDerivation rec {
|
||||||
substituteInPlace $sourceRoot/android/gradlew \
|
substituteInPlace $sourceRoot/android/gradlew \
|
||||||
--replace \
|
--replace \
|
||||||
'exec gradle' \
|
'exec gradle' \
|
||||||
"exec gradle -Dmaven.repo.local='${localMavenRepo}' --offline ${gradleOpts}"
|
"exec gradle -Dmaven.repo.local='${localMavenRepo}' --offline ${toString gradleOpts}"
|
||||||
|
|
||||||
set $prevSet
|
set $prevSet
|
||||||
'';
|
'';
|
||||||
buildPhase = let
|
buildPhase = let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
stringLength optionalString substring
|
stringLength optionalString substring
|
||||||
concatStrings concatStringsSep
|
toInt concatStrings concatStringsSep
|
||||||
catAttrs mapAttrsToList makeLibraryPath;
|
catAttrs mapAttrsToList makeLibraryPath;
|
||||||
|
|
||||||
# Take the env attribute set and build a couple of scripts
|
# Take the env attribute set and build a couple of scripts
|
||||||
|
@ -140,7 +136,7 @@ in stdenv.mkDerivation rec {
|
||||||
adhocEnvVars = optionalString stdenv.isLinux
|
adhocEnvVars = optionalString stdenv.isLinux
|
||||||
"LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${makeLibraryPath [ zlib ]}";
|
"LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${makeLibraryPath [ zlib ]}";
|
||||||
in
|
in
|
||||||
assert stringLength env.ANDROID_ABI_SPLIT > 0;
|
assert env.ANDROID_ABI_SPLIT != null && env.ANDROID_ABI_SPLIT != "";
|
||||||
assert stringLength env.ANDROID_ABI_INCLUDE > 0;
|
assert stringLength env.ANDROID_ABI_INCLUDE > 0;
|
||||||
''
|
''
|
||||||
export ANDROID_SDK_ROOT="${androidPkgs}"
|
export ANDROID_SDK_ROOT="${androidPkgs}"
|
||||||
|
@ -151,16 +147,19 @@ in stdenv.mkDerivation rec {
|
||||||
export STATUS_REACT_HOME=$PWD
|
export STATUS_REACT_HOME=$PWD
|
||||||
export HOME=$sourceRoot
|
export HOME=$sourceRoot
|
||||||
|
|
||||||
|
# Used by the Android Gradle build script in android/build.gradle
|
||||||
|
export STATUS_GO_ANDROID_LIBDIR=${status-go}
|
||||||
|
|
||||||
${exportEnvVars}
|
${exportEnvVars}
|
||||||
${optionalString (secretsFile != "") "source ${secretsFile}"}
|
${optionalString (secretsFile != "") "source ${secretsFile}"}
|
||||||
|
|
||||||
${concatStrings (catAttrs "shellHook" [ mavenAndNpmDeps.shell status-go.shell ])}
|
${concatStrings (catAttrs "shellHook" [ mavenAndNpmDeps.shell ])}
|
||||||
|
|
||||||
# fix permissions so gradle can create directories
|
# fix permissions so gradle can create directories
|
||||||
chmod -R +w $sourceRoot/android
|
chmod -R +w $sourceRoot/android
|
||||||
|
|
||||||
pushd $sourceRoot/android
|
pushd $sourceRoot/android
|
||||||
${adhocEnvVars} ./gradlew -PversionCode=${buildNumber} assemble${gradleBuildType} || exit
|
${adhocEnvVars} ./gradlew -PversionCode=${toString buildNumber} assemble${gradleBuildType} || exit
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
'';
|
'';
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
|
|
|
@ -12,17 +12,17 @@ let
|
||||||
|
|
||||||
android = callPackage ./android {
|
android = callPackage ./android {
|
||||||
inherit localMavenRepoBuilder projectNodePackage;
|
inherit localMavenRepoBuilder projectNodePackage;
|
||||||
status-go = status-go.android;
|
status-go = status-go.mobile.android;
|
||||||
};
|
};
|
||||||
|
|
||||||
ios = callPackage ./ios {
|
ios = callPackage ./ios {
|
||||||
inherit xcodeWrapper projectNodePackage fastlane;
|
inherit xcodeWrapper projectNodePackage fastlane;
|
||||||
status-go = status-go.ios;
|
status-go = status-go.mobile.ios;
|
||||||
};
|
};
|
||||||
|
|
||||||
selectedSources = [
|
selectedSources = [
|
||||||
status-go.android
|
status-go.mobile.android
|
||||||
status-go.ios
|
status-go.mobile.ios
|
||||||
fastlane
|
fastlane
|
||||||
android
|
android
|
||||||
ios
|
ios
|
||||||
|
|
|
@ -33,7 +33,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
inherit buildInputs pod-shell;
|
inherit buildInputs pod-shell status-go-shell;
|
||||||
|
|
||||||
shell = lib.mergeSh localShell [
|
shell = lib.mergeSh localShell [
|
||||||
fastlane.shell status-go-shell pod-shell
|
fastlane.shell status-go-shell pod-shell
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
|
#
|
||||||
|
# This prepares status-go build file called Statusgo.framework for XCode.
|
||||||
|
# It copies the status-go build result to 'modules/react-native-status/ios/RCTStatus'.
|
||||||
|
#
|
||||||
|
|
||||||
{ lib, mkShell, status-go }:
|
{ lib, mkShell, status-go }:
|
||||||
|
|
||||||
let
|
mkShell {
|
||||||
shell = mkShell {
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
if [ -z "$STATUS_GO_IOS_LIBDIR" ]; then
|
export STATUS_GO_IOS_LIBDIR=${status-go}/Statusgo.framework
|
||||||
echo "STATUS_GO_IOS_LIBDIR is not defined! Aborting."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
RCTSTATUS_DIR="$STATUS_REACT_HOME/modules/react-native-status/ios/RCTStatus"
|
RCTSTATUS_DIR="$STATUS_REACT_HOME/modules/react-native-status/ios/RCTStatus"
|
||||||
targetBasename='Statusgo.framework'
|
targetBasename='Statusgo.framework'
|
||||||
|
|
||||||
# Compare target folder with source to see if copying is required
|
# Compare target folder with source to see if copying is required
|
||||||
if [ -d "$RCTSTATUS_DIR/$targetBasename" ] && [ -d $STATUS_REACT_HOME/ios/Pods/ ] && \
|
if [ -d "$RCTSTATUS_DIR/$targetBasename" ] && [ -d $STATUS_REACT_HOME/ios/Pods/ ] && \
|
||||||
diff -q --no-dereference --recursive $RCTSTATUS_DIR/$targetBasename/ $STATUS_GO_IOS_LIBDIR/ > /dev/null; then
|
diff -qr --no-dereference $RCTSTATUS_DIR/$targetBasename/ $STATUS_GO_IOS_LIBDIR/ > /dev/null; then
|
||||||
echo "$RCTSTATUS_DIR/$targetBasename already in place"
|
echo "$RCTSTATUS_DIR/$targetBasename already in place"
|
||||||
else
|
else
|
||||||
sourceBasename="$(basename $STATUS_GO_IOS_LIBDIR)"
|
sourceBasename="$(basename $STATUS_GO_IOS_LIBDIR)"
|
||||||
|
@ -26,6 +27,4 @@ let
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
}
|
||||||
in
|
|
||||||
lib.mergeSh status-go.shell [ shell ]
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#
|
|
||||||
# Override some packages and utilities in 'pkgs'
|
# Override some packages and utilities in 'pkgs'
|
||||||
# and make them available globally via callPackage.
|
# and make them available globally via callPackage.
|
||||||
#
|
#
|
||||||
|
@ -9,18 +8,17 @@
|
||||||
|
|
||||||
self: super:
|
self: super:
|
||||||
|
|
||||||
let
|
let inherit (super) stdenv stdenvNoCC callPackage;
|
||||||
inherit (super) stdenv stdenvNoCC callPackage;
|
|
||||||
in {
|
in {
|
||||||
# Fix for MacOS
|
# Fix for MacOS
|
||||||
mkShell = super.mkShell.override { stdenv = stdenvNoCC; };
|
mkShell = super.mkShell.override { stdenv = stdenvNoCC; };
|
||||||
|
|
||||||
# Various utilities
|
# Various utilities
|
||||||
utils = callPackage ./tools/utils.nix { };
|
utils = callPackage ./tools/utils.nix { };
|
||||||
lib = (super.lib or {}) // {
|
lib = (super.lib or { }) // (import ./lib {
|
||||||
mkFilter = callPackage ./tools/mkFilter.nix { };
|
inherit (super) lib;
|
||||||
mergeSh = callPackage ./tools/mergeSh.nix { };
|
inherit (self) config;
|
||||||
};
|
});
|
||||||
|
|
||||||
# Android environement
|
# Android environement
|
||||||
androidEnvCustom = callPackage ./mobile/android/sdk { };
|
androidEnvCustom = callPackage ./mobile/android/sdk { };
|
||||||
|
@ -34,4 +32,8 @@ in {
|
||||||
|
|
||||||
# Custom packages
|
# Custom packages
|
||||||
gomobile = callPackage ./pkgs/gomobile { };
|
gomobile = callPackage ./pkgs/gomobile { };
|
||||||
|
qt5custom = callPackage ./pkgs/qt5custom { };
|
||||||
|
qtkeychain-src = callPackage ./pkgs/qtkeychain-src { };
|
||||||
|
appimagekit = callPackage ./pkgs/appimagekit { };
|
||||||
|
linuxdeployqt = callPackage ./pkgs/linuxdeployqt { inherit (self) appimagekit; };
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
{ qt5 }:
|
||||||
|
|
||||||
|
# Custom collection of QT libraries for Status desktop App
|
||||||
|
qt5.env "qt-status-${qt5.qtbase.version}" (with qt5; [
|
||||||
|
qtbase
|
||||||
|
qtsvg
|
||||||
|
qtwebengine
|
||||||
|
qtwebview
|
||||||
|
qtdeclarative
|
||||||
|
qtquickcontrols2
|
||||||
|
])
|
|
@ -0,0 +1,40 @@
|
||||||
|
{ pkgs, stdenv, fetchFromGitHub }:
|
||||||
|
|
||||||
|
let
|
||||||
|
version = "0.8.90";
|
||||||
|
# This revision will get used in:
|
||||||
|
# https://github.com/status-im/react-native-keychain/blob/master/desktop/CMakeLists.txt#L45
|
||||||
|
rev = "d3c606c55adf8c2c2747556055652b3469f6c4c2";
|
||||||
|
sha256 = "1gqw3g0j46aswncm8fgy419lp1fp2y2nild82hs18xra5albvf3i";
|
||||||
|
|
||||||
|
in stdenv.mkDerivation {
|
||||||
|
name = "qtkeychain-patched-source";
|
||||||
|
version = "${version}-${stdenv.lib.strings.substring 0 7 rev}";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
inherit rev sha256;
|
||||||
|
owner = "status-im";
|
||||||
|
repo = "qtkeychain";
|
||||||
|
name = "qtkeychain-source-${version}";
|
||||||
|
};
|
||||||
|
|
||||||
|
phases = [ "unpackPhase" ];
|
||||||
|
unpackPhase = ''
|
||||||
|
mkdir -p $out/src
|
||||||
|
cp -r $src/* $out/src/
|
||||||
|
substituteInPlace $out/src/CMakeLists.txt \
|
||||||
|
--replace "cmake_minimum_required(VERSION 2.8.11)" "cmake_minimum_required(VERSION 3.12.1)" \
|
||||||
|
--replace "project(qtkeychain)" "project(qtkeychain VERSION ${version})" \
|
||||||
|
--replace "set(QTKEYCHAIN_VERSION 0.8.90)" "set(QTKEYCHAIN_VERSION ${version})" \
|
||||||
|
--replace "{QTKEYCHAIN_VERSION}\" VARIABLE_PREFIX SNORE" "QTKEYCHAIN_VERSION VARIABLE_PREFIX SNORE" \
|
||||||
|
--replace "\"\$QTKEYCHAIN_VERSION" qtkeychain
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with stdenv.lib; {
|
||||||
|
description = "Patched sources for qtkeychain, a platform-independent Qt API for storing passwords securely";
|
||||||
|
homepage = https://github.com/status-im/qtkeychain;
|
||||||
|
license = licenses.bsd3;
|
||||||
|
maintainers = [ maintainers.pombeirp ];
|
||||||
|
platforms = with platforms; darwin ++ linux;
|
||||||
|
};
|
||||||
|
}
|
|
@ -23,7 +23,8 @@ function cleanup() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -z "${_NIX_NO_CLEAN}" ]]; then
|
# If you want to clean after every build set _NIX_CLEAN=true
|
||||||
|
if [[ -n "${_NIX_CLEAN}" ]]; then
|
||||||
trap cleanup EXIT ERR INT QUIT
|
trap cleanup EXIT ERR INT QUIT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -31,9 +32,8 @@ fi
|
||||||
function extractResults() {
|
function extractResults() {
|
||||||
local nixResultPath="$1"
|
local nixResultPath="$1"
|
||||||
mkdir -p "${resultPath}"
|
mkdir -p "${resultPath}"
|
||||||
cp -vfr ${nixResultPath}/* "${resultPath}"
|
cp -vfr ${nixResultPath}/* "${resultPath}" | sed 's#'${PWD}'#.#'
|
||||||
chmod -R u+w "${resultPath}"
|
chmod -R u+w "${resultPath}"
|
||||||
ls -l "${resultPath}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
targetAttr="${1}"
|
targetAttr="${1}"
|
||||||
|
@ -58,7 +58,8 @@ nixOpts=(
|
||||||
echo "Running: nix-build "${nixOpts[@]}" "${@}" default.nix"
|
echo "Running: nix-build "${nixOpts[@]}" "${@}" default.nix"
|
||||||
nixResultPath=$(nix-build "${nixOpts[@]}" "${@}" default.nix)
|
nixResultPath=$(nix-build "${nixOpts[@]}" "${@}" default.nix)
|
||||||
|
|
||||||
echo "Extracting result: ${nixResultPath}"
|
echo -e "\n${YLW}Extracting result${RST}: ${BLD}${nixResultPath}${RST}"
|
||||||
|
|
||||||
extractResults "${nixResultPath}"
|
extractResults "${nixResultPath}"
|
||||||
|
|
||||||
echo -e "${GRN}SUCCESS${RST}"
|
echo -e "\n${GRN}SUCCESS${RST}"
|
||||||
|
|
|
@ -26,12 +26,12 @@ fi
|
||||||
entryPoint="default.nix"
|
entryPoint="default.nix"
|
||||||
nixArgs+=("--attr shells.${TARGET}")
|
nixArgs+=("--attr shells.${TARGET}")
|
||||||
|
|
||||||
|
|
||||||
if [[ "$TARGET" =~ (linux|windows|darwin|macos) ]]; then
|
if [[ "$TARGET" =~ (linux|windows|darwin|macos) ]]; then
|
||||||
# This is a dirty workaround because 'yarn install' is an impure operation,
|
# This is a dirty workaround because 'yarn install' is an impure operation,
|
||||||
# so we need to call it from an impure shell.
|
# so we need to call it from an impure shell.
|
||||||
# Hopefully we'll be able to fix this later on with something like yarn2nix
|
# Hopefully we'll be able to fix this later on with something like yarn2nix
|
||||||
nix-shell ${nixArgs[@]} --run "scripts/prepare-for-desktop-platform.sh" || exit
|
# TODO: Manage node dependencies for desktop with yarn2nix
|
||||||
|
nix-shell ${nixArgs[@]} --run "scripts/prepare-for-desktop-platform.sh" default.nix || exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config=''
|
config=''
|
||||||
|
|
|
@ -65,19 +65,20 @@ let
|
||||||
buildInputs = [ pkgs.openjdk8 ];
|
buildInputs = [ pkgs.openjdk8 ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# for targets that need 'adb'
|
# for targets that need 'adb' and other SDK/NDK tools
|
||||||
android-env = targets.mobile.android.env.shell;
|
android-env = pkgs.androidShell;
|
||||||
|
|
||||||
# helpers for use with target argument
|
# helpers for use with target argument
|
||||||
|
ios = targets.mobile.ios.shell;
|
||||||
|
android = targets.mobile.android.shell;
|
||||||
|
desktop = targets.desktop.shell;
|
||||||
linux = targets.desktop.linux.shell;
|
linux = targets.desktop.linux.shell;
|
||||||
macos = targets.desktop.macos.shell;
|
macos = targets.desktop.macos.shell;
|
||||||
windows = targets.desktop.windows.shell;
|
windows = targets.desktop.macos.shell;
|
||||||
android = targets.mobile.android.shell;
|
|
||||||
ios = targets.mobile.ios.shell;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# for merging the default shell with others
|
# for merging the default shell with others
|
||||||
mergeDefaultShell = (name: value: lib.mergeSh default [ value ]);
|
mergeDefaultShell = (key: val: lib.mergeSh default [ val ]);
|
||||||
|
|
||||||
# values here can be selected using `nix-shell --attr shells.$TARGET default.nix`
|
# values here can be selected using `nix-shell --attr shells.$TARGET default.nix`
|
||||||
# the nix/scripts/shell.sh wrapper does this for us and expects TARGET to be set
|
# the nix/scripts/shell.sh wrapper does this for us and expects TARGET to be set
|
||||||
|
|
|
@ -1,76 +0,0 @@
|
||||||
{ buildGoPackage, go, xcodeWrapper, stdenv, utils }:
|
|
||||||
|
|
||||||
{ owner, repo, rev, cleanVersion, goPackagePath, src, host,
|
|
||||||
nativeBuildInputs ? [],
|
|
||||||
buildInputs ? [],
|
|
||||||
buildPhase, buildMessage,
|
|
||||||
installPhase ? "",
|
|
||||||
postInstall ? "",
|
|
||||||
preFixup ? "",
|
|
||||||
outputs, meta } @ args':
|
|
||||||
|
|
||||||
with stdenv;
|
|
||||||
|
|
||||||
let
|
|
||||||
inherit (stdenv.lib) strings;
|
|
||||||
|
|
||||||
removeReferences = [ go ];
|
|
||||||
removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}'';
|
|
||||||
|
|
||||||
args = removeAttrs args' [ "buildMessage" ]; # Remove our arguments from args before passing them on to buildGoPackage
|
|
||||||
buildStatusGo = buildGoPackage (args // {
|
|
||||||
pname = repo;
|
|
||||||
version = "${cleanVersion}-${strings.substring 0 7 rev}-${host}";
|
|
||||||
|
|
||||||
nativeBuildInputs =
|
|
||||||
nativeBuildInputs ++
|
|
||||||
lib.optional isDarwin xcodeWrapper;
|
|
||||||
inherit buildInputs;
|
|
||||||
|
|
||||||
# Fixes Cgo related build failures (see https://github.com/NixOS/nixpkgs/issues/25959 )
|
|
||||||
hardeningDisable = [ "fortify" ];
|
|
||||||
|
|
||||||
# Ensure XCode is present, instead of failing at the end of the build
|
|
||||||
preConfigure = lib.optionalString isDarwin utils.enforceXCodeAvailable;
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
runHook preBuild
|
|
||||||
|
|
||||||
runHook renameImports
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "${buildMessage}"
|
|
||||||
echo
|
|
||||||
${buildPhase}
|
|
||||||
|
|
||||||
runHook postBuild
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
|
|
||||||
${installPhase}
|
|
||||||
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
|
|
||||||
# replace hardcoded paths to go package in /nix/store, otherwise Nix will fail the build
|
|
||||||
preFixup = preFixup + ''
|
|
||||||
find $out -type f -exec ${removeExpr removeReferences} '{}' + || true
|
|
||||||
return # make sure we stop fixup so as to not allow the host preFixup script to proceed
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru = { inherit owner repo version rev; };
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
# Add default meta information
|
|
||||||
inherit (meta) platforms;
|
|
||||||
description = meta.description or "The Status module that consumes go-ethereum.";
|
|
||||||
license = lib.licenses.mpl20;
|
|
||||||
} // meta // {
|
|
||||||
# add an extra maintainer to every package
|
|
||||||
maintainers = (meta.maintainers or [ ]) ++ [ lib.maintainers.pombeirp ];
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
in buildStatusGo
|
|
|
@ -1,128 +1,26 @@
|
||||||
{ config, lib, utils, stdenv, callPackage, mkShell,
|
{ lib, callPackage, mkShell, openjdk, androidPkgs }:
|
||||||
fetchFromGitHub, openjdk, androidPkgs }:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (stdenv.lib)
|
inherit (lib)
|
||||||
catAttrs concatStrings concatStringsSep fileContents importJSON makeBinPath
|
catAttrs concatStrings concatStringsSep fileContents makeBinPath
|
||||||
optional optionalString strings attrValues mapAttrs attrByPath
|
getConfig optional attrValues mapAttrs attrByPath;
|
||||||
traceValFn;
|
|
||||||
|
|
||||||
envFlags = callPackage ../tools/envParser.nix { };
|
# Metadata common to all builds of status-go
|
||||||
enableNimbus = (attrByPath ["STATUS_GO_ENABLE_NIMBUS"] "0" envFlags) != "0";
|
meta = {
|
||||||
|
description = "The Status Go module that consumes go-ethereum.";
|
||||||
nimbus =
|
license = lib.licenses.mpl20;
|
||||||
if enableNimbus then callPackage ./nimbus { }
|
platforms = with lib.platforms; linux ++ darwin;
|
||||||
else { wrappers-android = { }; };
|
|
||||||
|
|
||||||
buildStatusGoDesktopLib = callPackage ./desktop { };
|
|
||||||
buildStatusGoMobileLib = callPackage ./mobile { };
|
|
||||||
|
|
||||||
srcData =
|
|
||||||
# If config.status-im.status-go.src-override is defined, instruct Nix to use that path to build status-go
|
|
||||||
if (attrByPath ["status-im" "status-go" "src-override"] "" config) != "" then rec {
|
|
||||||
owner = "status-im";
|
|
||||||
repo = "status-go";
|
|
||||||
rev = "unknown";
|
|
||||||
shortRev = "unknown";
|
|
||||||
rawVersion = "develop";
|
|
||||||
cleanVersion = rawVersion;
|
|
||||||
goPackagePath = "github.com/${owner}/${repo}";
|
|
||||||
src =
|
|
||||||
let path = traceValFn (path: "Using local ${repo} sources from ${path}\n") config.status-im.status-go.src-override;
|
|
||||||
in builtins.path { # We use builtins.path so that we can name the resulting derivation, otherwise the name would be taken from the checkout directory, which is outside of our control
|
|
||||||
inherit path;
|
|
||||||
name = "${repo}-source-${shortRev}";
|
|
||||||
filter =
|
|
||||||
# Keep this filter as restrictive as possible in order to avoid unnecessary rebuilds and limit closure size
|
|
||||||
lib.mkFilter {
|
|
||||||
root = path;
|
|
||||||
include = [ ".*" ];
|
|
||||||
exclude = [
|
|
||||||
".*/[.]git.*" ".*[.]md" ".*[.]yml"
|
|
||||||
".*/.*_test.go$" "_assets/.*" "build/.*"
|
|
||||||
".*/.*LICENSE.*" ".*/CONTRIB.*" ".*/AUTHOR.*"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} else
|
|
||||||
# Otherwise grab it from the location defined by status-go-version.json
|
|
||||||
let
|
|
||||||
versionJSON = importJSON ../../status-go-version.json; # TODO: Simplify this path search with lib.locateDominatingFile
|
|
||||||
sha256 = versionJSON.src-sha256;
|
|
||||||
in rec {
|
|
||||||
inherit (versionJSON) owner repo version;
|
|
||||||
rev = versionJSON.commit-sha1;
|
|
||||||
shortRev = strings.substring 0 7 rev;
|
|
||||||
rawVersion = versionJSON.version;
|
|
||||||
cleanVersion = utils.sanitizeVersion versionJSON.version;
|
|
||||||
goPackagePath = "github.com/${owner}/${repo}";
|
|
||||||
src = fetchFromGitHub { inherit rev owner repo sha256; name = "${repo}-${srcData.shortRev}-source"; };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mobileConfigs = {
|
# Source can be changed with a local override from config
|
||||||
android = rec {
|
source = callPackage ./source.nix { };
|
||||||
name = "android";
|
|
||||||
envVars = [
|
|
||||||
"ANDROID_HOME=${androidPkgs}"
|
|
||||||
"ANDROID_NDK_HOME=${androidPkgs}/ndk-bundle"
|
|
||||||
"PATH=${makeBinPath [ openjdk ]}:$PATH"
|
|
||||||
];
|
|
||||||
gomobileExtraFlags = [ "-androidapi 23" ];
|
|
||||||
outputFileName = "status-go-${srcData.shortRev}.aar";
|
|
||||||
platforms = {
|
|
||||||
arm64 = {
|
|
||||||
linkNimbus = enableNimbus;
|
|
||||||
nimbus = assert enableNimbus; nimbus.wrappers-android.arm64;
|
|
||||||
gomobileTarget = "${name}/arm64";
|
|
||||||
outputFileName = "status-go-${srcData.shortRev}-arm64.aar";
|
|
||||||
};
|
|
||||||
arm = {
|
|
||||||
linkNimbus = enableNimbus;
|
|
||||||
nimbus = assert enableNimbus; nimbus.wrappers-android.arm;
|
|
||||||
gomobileTarget = "${name}/arm";
|
|
||||||
outputFileName = "status-go-${srcData.shortRev}-arm.aar";
|
|
||||||
};
|
|
||||||
x86 = {
|
|
||||||
linkNimbus = enableNimbus;
|
|
||||||
nimbus = assert enableNimbus; nimbus.wrappers-android.x86;
|
|
||||||
gomobileTarget = "${name}/386";
|
|
||||||
outputFileName = "status-go-${srcData.shortRev}-386.aar";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
ios = rec {
|
|
||||||
name = "ios";
|
|
||||||
envVars = [];
|
|
||||||
gomobileExtraFlags = [ "-iosversion=8.0" ];
|
|
||||||
outputFileName = "Statusgo.framework";
|
|
||||||
platforms = {
|
|
||||||
ios = {
|
|
||||||
linkNimbus = enableNimbus;
|
|
||||||
nimbus = assert false; null; # TODO: Currently we don't support Nimbus on iOS
|
|
||||||
gomobileTarget = name;
|
|
||||||
inherit outputFileName;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
hostConfigs = {
|
|
||||||
darwin = {
|
|
||||||
name = "macos";
|
|
||||||
allTargets = [ status-go-packages.desktop status-go-packages.ios status-go-packages.android ];
|
|
||||||
};
|
|
||||||
linux = {
|
|
||||||
name = "linux";
|
|
||||||
allTargets = [ status-go-packages.desktop status-go-packages.android ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
currentHostConfig = if stdenv.isDarwin then hostConfigs.darwin else hostConfigs.linux;
|
|
||||||
|
|
||||||
goBuildFlags = concatStringsSep " " [ "-v" (optionalString enableNimbus "-tags='nimbus'") ];
|
# Params to be set at build time, important for About section and metrics
|
||||||
# status-go params to be set at build time, important for About section and metrics
|
|
||||||
goBuildParams = {
|
goBuildParams = {
|
||||||
GitCommit = srcData.rev;
|
GitCommit = source.rev;
|
||||||
Version = srcData.cleanVersion;
|
Version = source.cleanVersion;
|
||||||
};
|
};
|
||||||
|
|
||||||
# These are necessary for status-go to show correct version
|
# These are necessary for status-go to show correct version
|
||||||
paramsLdFlags = attrValues (mapAttrs (name: value:
|
paramsLdFlags = attrValues (mapAttrs (name: value:
|
||||||
"-X github.com/status-im/status-go/params.${name}=${value}"
|
"-X github.com/status-im/status-go/params.${name}=${value}"
|
||||||
|
@ -133,61 +31,14 @@ let
|
||||||
"-w" # -w disables DWARF debugging information
|
"-w" # -w disables DWARF debugging information
|
||||||
];
|
];
|
||||||
|
|
||||||
statusGoArgs = { inherit (srcData) src owner repo rev cleanVersion goPackagePath; inherit goBuildFlags goBuildLdFlags; };
|
goBuildFlags = [ "-v" ];
|
||||||
status-go-packages = {
|
|
||||||
desktop = buildStatusGoDesktopLib (statusGoArgs // {
|
|
||||||
outputFileName = "libstatus.a";
|
|
||||||
hostSystem = stdenv.hostPlatform.system;
|
|
||||||
host = currentHostConfig.name;
|
|
||||||
});
|
|
||||||
|
|
||||||
android = buildStatusGoMobileLib (statusGoArgs // {
|
in rec {
|
||||||
host = mobileConfigs.android.name;
|
mobile = callPackage ./mobile {
|
||||||
targetConfig = mobileConfigs.android;
|
inherit meta source goBuildFlags goBuildLdFlags;
|
||||||
});
|
|
||||||
|
|
||||||
ios = buildStatusGoMobileLib (statusGoArgs // {
|
|
||||||
host = mobileConfigs.ios.name;
|
|
||||||
targetConfig = mobileConfigs.ios;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
android = rec {
|
desktop = callPackage ./desktop {
|
||||||
buildInputs = [ status-go-packages.android ];
|
inherit meta source goBuildFlags goBuildLdFlags;
|
||||||
shell = mkShell {
|
|
||||||
inherit buildInputs;
|
|
||||||
shellHook = ''
|
|
||||||
# These variables are used by the Status Android Gradle build script in android/build.gradle
|
|
||||||
export STATUS_GO_ANDROID_LIBDIR=${status-go-packages.android}/lib
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
ios = rec {
|
|
||||||
buildInputs = [ status-go-packages.ios ];
|
|
||||||
shell = mkShell {
|
|
||||||
inherit buildInputs;
|
|
||||||
shellHook = ''
|
|
||||||
# These variables are used by the iOS build preparation section in nix/mobile/ios/default.nix
|
|
||||||
export STATUS_GO_IOS_LIBDIR=${status-go-packages.ios}/lib/Statusgo.framework
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
desktop = rec {
|
|
||||||
buildInputs = [ status-go-packages.desktop ];
|
|
||||||
shell = mkShell {
|
|
||||||
inherit buildInputs;
|
|
||||||
shellHook = ''
|
|
||||||
# These variables are used by the Status Desktop CMake build script in modules/react-native-status/desktop/CMakeLists.txt
|
|
||||||
export STATUS_GO_DESKTOP_INCLUDEDIR=${status-go-packages.desktop}/include
|
|
||||||
export STATUS_GO_DESKTOP_LIBDIR=${status-go-packages.desktop}/lib
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
platforms = [ android ios desktop ];
|
|
||||||
|
|
||||||
in {
|
|
||||||
shell = lib.mergeSh mkShell {} (catAttrs "shell" platforms);
|
|
||||||
|
|
||||||
# CHILD DERIVATIONS
|
|
||||||
inherit android ios desktop;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +1,43 @@
|
||||||
{ stdenv, utils, callPackage, buildGoPackage, go, xcodeWrapper }:
|
{ lib, stdenv, utils, go, buildGoPackage
|
||||||
|
# object with source attributes
|
||||||
{ owner, repo, rev, cleanVersion, goPackagePath, src, host,
|
, meta , source
|
||||||
# desktop-only arguments
|
, goBuildFlags
|
||||||
goBuildFlags, goBuildLdFlags,
|
, goBuildLdFlags
|
||||||
outputFileName,
|
, outputFileName ? "libstatus.a" }:
|
||||||
hostSystem } @ args':
|
|
||||||
|
|
||||||
let
|
let
|
||||||
buildStatusGo = callPackage ../build.nix {
|
inherit (lib) concatStringsSep optionalString concatMapStrings;
|
||||||
inherit buildGoPackage go xcodeWrapper utils;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Remove desktop-only arguments from args
|
removeReferences = [ go ];
|
||||||
args = removeAttrs args' [
|
removeExpr = refs: ''remove-references-to ${concatMapStrings (ref: " -t ${ref}") refs}'';
|
||||||
"goBuildFlags" "goBuildLdFlags" "outputFileName" "hostSystem"
|
|
||||||
];
|
hostSystem = stdenv.hostPlatform.system;
|
||||||
|
|
||||||
|
in buildGoPackage {
|
||||||
|
pname = source.repo;
|
||||||
|
version = "${source.cleanVersion}-${source.shortRev}";
|
||||||
|
|
||||||
|
inherit meta;
|
||||||
|
inherit (source) src goPackagePath;
|
||||||
|
|
||||||
|
# Fixes Cgo related build failures (see https://github.com/NixOS/nixpkgs/issues/25959 )
|
||||||
|
hardeningDisable = [ "fortify" ];
|
||||||
|
|
||||||
|
# Ensure XCode is present, instead of failing at the end of the build
|
||||||
|
preConfigure = optionalString stdenv.isDarwin utils.enforceXCodeAvailable;
|
||||||
|
|
||||||
buildStatusGoDesktopLib = buildStatusGo (args // {
|
|
||||||
buildMessage = "Building desktop library";
|
buildMessage = "Building desktop library";
|
||||||
|
|
||||||
#GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build ${goBuildFlags} -buildmode=c-archive -o $out/${outputFileName} ./lib
|
#GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build ${goBuildFlags} -buildmode=c-archive -o $out/${outputFileName} ./lib
|
||||||
buildPhase =
|
buildPhase = let
|
||||||
let
|
CGO_LDFLAGS = concatStringsSep " " goBuildLdFlags;
|
||||||
CGO_LDFLAGS = stdenv.lib.concatStringsSep " " goBuildLdFlags;
|
|
||||||
in ''
|
in ''
|
||||||
pushd "$NIX_BUILD_TOP/go/src/${goPackagePath}" >/dev/null
|
pushd "$NIX_BUILD_TOP/go/src/${source.goPackagePath}" >/dev/null
|
||||||
|
|
||||||
export GO111MODULE=off
|
export GO111MODULE=off
|
||||||
|
|
||||||
go build -o $out/${outputFileName} \
|
go build -o $out/${outputFileName} \
|
||||||
${goBuildFlags} \
|
${concatStringsSep " " goBuildFlags} \
|
||||||
-buildmode=c-archive \
|
-buildmode=c-archive \
|
||||||
-ldflags='${CGO_LDFLAGS}' \
|
-ldflags='${CGO_LDFLAGS}' \
|
||||||
./lib
|
./lib
|
||||||
|
@ -36,6 +45,11 @@ let
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# replace hardcoded paths to go package in /nix/store, otherwise Nix will fail the build
|
||||||
|
fixupPhase = ''
|
||||||
|
find $out -type f -exec ${removeExpr removeReferences} '{}' + || true
|
||||||
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/lib/${hostSystem} $out/include
|
mkdir -p $out/lib/${hostSystem} $out/include
|
||||||
mv $out/${outputFileName} $out/lib/${hostSystem}
|
mv $out/${outputFileName} $out/lib/${hostSystem}
|
||||||
|
@ -43,8 +57,4 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "out" ];
|
outputs = [ "out" ];
|
||||||
|
}
|
||||||
meta = { platforms = with stdenv.lib.platforms; linux ++ darwin; };
|
|
||||||
});
|
|
||||||
|
|
||||||
in buildStatusGoDesktopLib
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#
|
||||||
|
# This is currently unused but is a reminder of how we used to build desktop app
|
||||||
|
#
|
||||||
|
|
||||||
|
{ mkShell, status-go-desktop }:
|
||||||
|
|
||||||
|
mkShell {
|
||||||
|
buildInputs = [ status-go-desktop ];
|
||||||
|
# These variables are used by the Status Desktop CMake build script in:
|
||||||
|
# - modules/react-native-status/desktop/CMakeLists.txt
|
||||||
|
shellHook = ''
|
||||||
|
export STATUS_GO_DESKTOP_INCLUDEDIR=${status-go-desktop}/include
|
||||||
|
export STATUS_GO_DESKTOP_LIBDIR=${status-go-desktop}/lib
|
||||||
|
'';
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
{ lib, stdenv, utils, callPackage, buildGoPackage
|
||||||
|
, go, androidPkgs, openjdk, gomobile, xcodeWrapper
|
||||||
|
# object with source attributes
|
||||||
|
, meta, source
|
||||||
|
, platform ? "android"
|
||||||
|
, architectures ? [ "arm64" "arm" "x86" ]
|
||||||
|
, goBuildFlags ? [ ]
|
||||||
|
, goBuildLdFlags ? [ ]
|
||||||
|
, outputFileName ? "status-go-${source.shortRev}-${platform}.aar" }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
concatStrings concatStringsSep concatMapStrings optionalString
|
||||||
|
getAttr attrValues makeBinPath optional;
|
||||||
|
|
||||||
|
removeReferences = [ go ];
|
||||||
|
removeExpr = refs: ''remove-references-to ${concatMapStrings (ref: " -t ${ref}") refs}'';
|
||||||
|
|
||||||
|
# formatted for use with -target
|
||||||
|
targetArchs = map (a: "${platform}/${a}") architectures;
|
||||||
|
|
||||||
|
in buildGoPackage {
|
||||||
|
pname = source.repo;
|
||||||
|
version = "${source.cleanVersion}-${source.shortRev}-${platform}";
|
||||||
|
|
||||||
|
inherit meta;
|
||||||
|
inherit (source) src goPackagePath;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ gomobile ]
|
||||||
|
++ optional (platform == "android") openjdk
|
||||||
|
++ optional stdenv.isDarwin xcodeWrapper;
|
||||||
|
|
||||||
|
# Fixes Cgo related build failures (see https://github.com/NixOS/nixpkgs/issues/25959 )
|
||||||
|
hardeningDisable = [ "fortify" ];
|
||||||
|
|
||||||
|
# Ensure XCode is present, instead of failing at the end of the build
|
||||||
|
preConfigure = optionalString stdenv.isDarwin utils.enforceXCodeAvailable;
|
||||||
|
|
||||||
|
# Build mobile libraries
|
||||||
|
preBuild = let
|
||||||
|
NIX_GOWORKDIR = "$NIX_BUILD_TOP/go-build";
|
||||||
|
in ''
|
||||||
|
|
||||||
|
mkdir ${NIX_GOWORKDIR}
|
||||||
|
|
||||||
|
export GO111MODULE=off
|
||||||
|
export GOPATH=${gomobile.dev}:$GOPATH
|
||||||
|
export NIX_GOWORKDIR=${NIX_GOWORKDIR}
|
||||||
|
|
||||||
|
'' + optionalString (platform == "android") ''
|
||||||
|
export ANDROID_HOME=${androidPkgs}
|
||||||
|
export ANDROID_NDK_HOME=${androidPkgs}/ndk-bundle
|
||||||
|
export PATH="${makeBinPath [ openjdk ]}:$PATH"
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Build the Go library using gomobile for each of the configured platforms
|
||||||
|
buildPhase = let
|
||||||
|
ldFlags = [ "-extldflags=-Wl,--allow-multiple-definition" ] ++ goBuildLdFlags;
|
||||||
|
CGO_LDFLAGS = concatStringsSep " " ldFlags;
|
||||||
|
in ''
|
||||||
|
runHook preBuild
|
||||||
|
runHook renameImports
|
||||||
|
|
||||||
|
echo -e "\nBuilding for targets: ${concatStringsSep "," targetArchs}\n"
|
||||||
|
|
||||||
|
${gomobile}/bin/gomobile bind \
|
||||||
|
-target=${concatStringsSep "," targetArchs} \
|
||||||
|
-ldflags="${CGO_LDFLAGS}" \
|
||||||
|
${optionalString (platform == "android") "-androidapi 23"} \
|
||||||
|
${optionalString (platform == "ios") "-iosversion=8.0"} \
|
||||||
|
${concatStringsSep " " goBuildFlags} \
|
||||||
|
-o ${outputFileName} \
|
||||||
|
${source.goPackagePath}/mobile
|
||||||
|
|
||||||
|
rm -rf $NIX_GOWORKDIR
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
# replace hardcoded paths to go package in /nix/store, otherwise Nix will fail the build
|
||||||
|
fixupPhase = ''
|
||||||
|
find $out -type f -exec ${removeExpr removeReferences} '{}' + || true
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
mv ${outputFileName} $out/
|
||||||
|
'';
|
||||||
|
|
||||||
|
outputs = [ "out" ];
|
||||||
|
}
|
|
@ -1,102 +1,20 @@
|
||||||
{ stdenv, utils, callPackage,
|
{ callPackage
|
||||||
buildGoPackage, go, gomobile, androidPkgs,
|
, meta, source
|
||||||
openjdk, unzip, zip, xcodeWrapper }:
|
, goBuildFlags
|
||||||
|
, goBuildLdFlags }:
|
||||||
|
|
||||||
{ owner, repo, rev, cleanVersion, goPackagePath, src, host,
|
{
|
||||||
|
android = callPackage ./build.nix {
|
||||||
# mobile-only arguments
|
platform = "android";
|
||||||
goBuildFlags, goBuildLdFlags,
|
architectures = [ "arm" "arm64" "386" ];
|
||||||
targetConfig } @ args':
|
outputFileName = "status-go-${source.shortRev}.aar";
|
||||||
|
inherit meta source goBuildFlags goBuildLdFlags;
|
||||||
let
|
|
||||||
inherit (stdenv.lib) concatStringsSep makeBinPath optional optionals;
|
|
||||||
|
|
||||||
buildStatusGo = callPackage ../build.nix {
|
|
||||||
inherit buildGoPackage go xcodeWrapper utils;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Remove mobile-only arguments from args
|
ios = callPackage ./build.nix {
|
||||||
args = removeAttrs args' [
|
platform = "ios";
|
||||||
"targetConfig" "goBuildFlags" "goBuildLdFlags"
|
architectures = [ "arm" "arm64" "386" ];
|
||||||
];
|
outputFileName = "Statusgo.framework";
|
||||||
|
inherit meta source goBuildFlags goBuildLdFlags;
|
||||||
buildStatusGoMobileLib =
|
};
|
||||||
let
|
|
||||||
inherit (stdenv.lib) concatStrings mapAttrsToList optionalString;
|
|
||||||
in buildStatusGo (args // {
|
|
||||||
nativeBuildInputs = [ gomobile unzip zip ] ++ optional (targetConfig.name == "android") openjdk;
|
|
||||||
|
|
||||||
buildMessage = "Building mobile library for ${targetConfig.name}";
|
|
||||||
# Build mobile libraries
|
|
||||||
buildPhase =
|
|
||||||
let
|
|
||||||
NIX_GOWORKDIR = "$NIX_BUILD_TOP/go-build";
|
|
||||||
CGO_LDFLAGS = concatStringsSep " " (goBuildLdFlags ++ [ "-extldflags=-Wl,--allow-multiple-definition" ]);
|
|
||||||
nimbusBridgeVendorDir = "$NIX_BUILD_TOP/go/src/${goPackagePath}/vendor/${goPackagePath}/eth-node/bridge/nimbus";
|
|
||||||
in ''
|
|
||||||
mkdir ${NIX_GOWORKDIR}
|
|
||||||
|
|
||||||
export GO111MODULE=off
|
|
||||||
export GOPATH=${gomobile.dev}:$GOPATH
|
|
||||||
export PATH=${makeBinPath [ gomobile.bin ]}:$PATH
|
|
||||||
export NIX_GOWORKDIR=${NIX_GOWORKDIR}
|
|
||||||
export ${concatStringsSep " " targetConfig.envVars}
|
|
||||||
|
|
||||||
# Build the Go library using gomobile for each of the configured platforms
|
|
||||||
${concatStrings (mapAttrsToList (_: platformConfig: ''
|
|
||||||
|
|
||||||
${optionalString platformConfig.linkNimbus ''
|
|
||||||
# Copy the Nimbus API artifacts to the expected vendor location
|
|
||||||
cp ${platformConfig.nimbus}/{include/*,lib/libnimbus.a} ${nimbusBridgeVendorDir}
|
|
||||||
chmod +w ${nimbusBridgeVendorDir}/libnimbus.{a,h}
|
|
||||||
''}
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Building for target ${platformConfig.gomobileTarget}"
|
|
||||||
gomobile bind \
|
|
||||||
-target=${platformConfig.gomobileTarget} \
|
|
||||||
-ldflags="${CGO_LDFLAGS}" \
|
|
||||||
${concatStringsSep " " targetConfig.gomobileExtraFlags} \
|
|
||||||
${goBuildFlags} \
|
|
||||||
-o ${platformConfig.outputFileName} \
|
|
||||||
${goPackagePath}/mobile
|
|
||||||
|
|
||||||
${optionalString platformConfig.linkNimbus ''
|
|
||||||
rm ${nimbusBridgeVendorDir}/libnimbus.{a,h}
|
|
||||||
''}
|
|
||||||
'') targetConfig.platforms)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "${targetConfig.name}" = 'android' ]; then
|
|
||||||
# Merge the platform-specific .aar files into a single one
|
|
||||||
local mergeDir='.aar'
|
|
||||||
mkdir $mergeDir
|
|
||||||
${concatStrings (mapAttrsToList (_: platformConfig: ''
|
|
||||||
unzip -d $mergeDir -q -n -u ${platformConfig.outputFileName}
|
|
||||||
rm ${platformConfig.outputFileName}
|
|
||||||
'') targetConfig.platforms)}
|
|
||||||
pushd $mergeDir > /dev/null
|
|
||||||
zip -r -o ../${targetConfig.outputFileName} *
|
|
||||||
popd > /dev/null
|
|
||||||
rm -rf $mergeDir
|
|
||||||
unzip -l ${targetConfig.outputFileName}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# TODO: Merge iOS packages when linking with libnimbus.a
|
|
||||||
|
|
||||||
rm -rf ${NIX_GOWORKDIR}
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/lib
|
|
||||||
mv ${targetConfig.outputFileName} $out/lib/
|
|
||||||
'';
|
|
||||||
|
|
||||||
outputs = [ "out" ];
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
platforms = with stdenv.lib.platforms; linux ++ darwin;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
in buildStatusGoMobileLib
|
|
||||||
|
|
|
@ -1,17 +1,28 @@
|
||||||
{ config, stdenv, callPackage, fetchFromGitHub, mkFilter }:
|
#
|
||||||
|
# This fetches nimbus source from local folder or GitHub and
|
||||||
|
# loads the derivation defined in the `nix/default.nix` in the repo.
|
||||||
|
#
|
||||||
|
|
||||||
|
{ config, lib, stdenv, callPackage, fetchFromGitHub }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (stdenv.lib) attrByPath strings traceValFn;
|
inherit (lib) getConfig attrByPath strings traceValFn;
|
||||||
|
|
||||||
repo = "nimbus";
|
repo = "nimbus";
|
||||||
|
|
||||||
localPath = attrByPath ["status-im" "nimbus" "src-override"] "" config;
|
localPath = getConfig "nimbus.src-override" "";
|
||||||
localSrc = builtins.path rec { # We use builtins.path so that we can name the resulting derivation, otherwise the name would be taken from the checkout directory, which is outside of our control
|
localSrc =
|
||||||
path = traceValFn (path: "Using local ${repo} sources from ${path}\n") localPath;
|
# We use builtins.path so that we can name the resulting derivation.
|
||||||
|
# Name would be taken from the checkout directory, and wouldn't be deterministic.
|
||||||
|
builtins.path rec {
|
||||||
|
path = traceValFn (path: ''
|
||||||
|
Using local ${repo} sources from ${path}
|
||||||
|
'') localPath;
|
||||||
name = "${repo}-source-local";
|
name = "${repo}-source-local";
|
||||||
filter =
|
filter =
|
||||||
# Keep this filter as restrictive as possible in order to avoid unnecessary rebuilds and limit closure size
|
# Keep this filter as restrictive as possible in order to
|
||||||
mkFilter {
|
# avoid unnecessary rebuilds and limit closure size
|
||||||
|
lib.mkFilter {
|
||||||
root = path;
|
root = path;
|
||||||
include = [
|
include = [
|
||||||
"nix.*" "wrappers.*" "vendor.*"
|
"nix.*" "wrappers.*" "vendor.*"
|
||||||
|
@ -20,8 +31,7 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
src = if localPath != "" then localSrc
|
ghSrc = fetchFromGitHub rec {
|
||||||
else fetchFromGitHub rec {
|
|
||||||
inherit repo;
|
inherit repo;
|
||||||
name = "${repo}-source-${strings.substring 0 7 rev}";
|
name = "${repo}-source-${strings.substring 0 7 rev}";
|
||||||
rev = "73278f20d0bf27fb7c6c331b515abb765814f1cc";
|
rev = "73278f20d0bf27fb7c6c331b515abb765814f1cc";
|
||||||
|
@ -29,6 +39,9 @@ let
|
||||||
sha256 = "0myq234zqnpmqsc2452xygnyc6sjs8x1blyrpa4bi9v2cwbyap5c";
|
sha256 = "0myq234zqnpmqsc2452xygnyc6sjs8x1blyrpa4bi9v2cwbyap5c";
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
src = if localPath != "" then localSrc else ghSrc;
|
||||||
|
|
||||||
nimbusDeriv = import "${src}/nix/default.nix";
|
nimbusDeriv = import "${src}/nix/default.nix";
|
||||||
|
|
||||||
in nimbusDeriv
|
in nimbusDeriv
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
{ config, utils, lib, callPackage, fetchFromGitHub }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib) strings traceValFn attrByPath importJSON;
|
||||||
|
|
||||||
|
srcOverride = attrByPath [ "status-im" "status-go" "src-override" ] null config;
|
||||||
|
# Warning message about using local sources
|
||||||
|
localSrcWarn = (path: "Using local status-go sources from ${path}");
|
||||||
|
|
||||||
|
localSrc = rec {
|
||||||
|
owner = "status-im";
|
||||||
|
repo = "status-go";
|
||||||
|
rev = "unknown";
|
||||||
|
shortRev = rev;
|
||||||
|
rawVersion = "develop";
|
||||||
|
cleanVersion = rawVersion;
|
||||||
|
goPackagePath = "github.com/${owner}/${repo}";
|
||||||
|
# We use builtins.path so that we can name the resulting derivation,
|
||||||
|
# Normally the name would not be deterministic, taken from the checkout directory.
|
||||||
|
src = builtins.path rec {
|
||||||
|
path = traceValFn localSrcWarn srcOverride;
|
||||||
|
name = "${repo}-source-${shortRev}";
|
||||||
|
# Keep this filter as restrictive as possible in order
|
||||||
|
# to avoid unnecessary rebuilds and limit closure size
|
||||||
|
filter = lib.mkFilter {
|
||||||
|
root = path;
|
||||||
|
include = [ ".*" ];
|
||||||
|
exclude = [
|
||||||
|
".*/[.]git.*" ".*[.]md" ".*[.]yml" ".*/.*_test.go$"
|
||||||
|
"_assets/.*" "build/.*"
|
||||||
|
".*/.*LICENSE.*" ".*/CONTRIB.*" ".*/AUTHOR.*"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
githubSrc = let
|
||||||
|
# TODO: Simplify this path search with lib.locateDominatingFile
|
||||||
|
versionJSON = importJSON ../../status-go-version.json;
|
||||||
|
sha256 = versionJSON.src-sha256;
|
||||||
|
in rec {
|
||||||
|
inherit (versionJSON) owner repo version;
|
||||||
|
rev = versionJSON.commit-sha1;
|
||||||
|
shortRev = strings.substring 0 7 rev;
|
||||||
|
rawVersion = versionJSON.version;
|
||||||
|
cleanVersion = utils.sanitizeVersion versionJSON.version;
|
||||||
|
goPackagePath = "github.com/${owner}/${repo}";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
inherit rev owner repo sha256;
|
||||||
|
name = "${repo}-${shortRev}-source";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
if srcOverride != null
|
||||||
|
# If config.status-im.status-go.src-override is defined,
|
||||||
|
# instruct Nix to use that path to build status-go
|
||||||
|
then localSrc
|
||||||
|
# Otherwise grab it from the location defined by status-go-version.json
|
||||||
|
else githubSrc
|
|
@ -7,14 +7,8 @@ let
|
||||||
inherit (pkgs) stdenv callPackage;
|
inherit (pkgs) stdenv callPackage;
|
||||||
|
|
||||||
status-go = callPackage ./status-go { };
|
status-go = callPackage ./status-go { };
|
||||||
|
desktop = callPackage ./desktop { inherit status-go; };
|
||||||
desktop = callPackage ./desktop {
|
mobile = callPackage ./mobile { inherit status-go; };
|
||||||
status-go = status-go.desktop;
|
|
||||||
};
|
|
||||||
|
|
||||||
mobile = callPackage ./mobile {
|
|
||||||
inherit status-go;
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
inherit mobile desktop status-go;
|
inherit mobile desktop status-go;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
# This Nix expression appends/modifies an existing attribute set
|
|
||||||
# in order to define STATUS_REACT_HOME for use multiple derivations and scripts
|
|
||||||
|
|
||||||
{ pkgs, stdenv ? pkgs.stdenv }:
|
|
||||||
|
|
||||||
# Declare a specialized mkShell function which adds some bootstrapping
|
|
||||||
# so that e.g. STATUS_REACT_HOME is automatically available in the shell
|
|
||||||
attrs:
|
|
||||||
(pkgs.mkShell.override({ inherit stdenv; }) attrs)
|
|
||||||
.overrideAttrs(super: rec {
|
|
||||||
nativeBuildInputs = (super.nativeBuildInputs or [ ]) ++ [ pkgs.git ];
|
|
||||||
|
|
||||||
# avoid terinal issues
|
|
||||||
TERM="xterm";
|
|
||||||
|
|
||||||
# default locale
|
|
||||||
LANG="en_US.UTF-8";
|
|
||||||
LANGUAGE="en_US.UTF-8";
|
|
||||||
|
|
||||||
shellSetup = ''
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ -z "$STATUS_REACT_HOME" ]; then
|
|
||||||
export STATUS_REACT_HOME=$(git rev-parse --show-toplevel)
|
|
||||||
fi
|
|
||||||
|
|
||||||
export SHELL_SETUP=done
|
|
||||||
|
|
||||||
set +e
|
|
||||||
'';
|
|
||||||
|
|
||||||
shellHook = ''
|
|
||||||
if [ -z "$SHELL_SETUP" ]; then
|
|
||||||
${shellSetup}
|
|
||||||
fi
|
|
||||||
|
|
||||||
${super.shellHook or ""}
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
)
|
|
|
@ -1,9 +1,14 @@
|
||||||
{ xcodeWrapper, lib }:
|
{ xcodeWrapper, lib }:
|
||||||
|
|
||||||
|
#
|
||||||
|
# This is a collection of various utilities used throught this repo.
|
||||||
|
#
|
||||||
|
|
||||||
let
|
let
|
||||||
RED = "\\033[0;31m";
|
RED = "\\033[0;31m";
|
||||||
GREEN = "\\033[0;32m";
|
GREEN = "\\033[0;32m";
|
||||||
NC = "\\033[0m";
|
NC = "\\033[0m";
|
||||||
|
|
||||||
_xcodeToolsTest = ''
|
_xcodeToolsTest = ''
|
||||||
xcode=0
|
xcode=0
|
||||||
iPhoneSDK=0
|
iPhoneSDK=0
|
||||||
|
@ -18,6 +23,7 @@ let
|
||||||
export SELECTED=$iPhoneSDK; ${_xcodeToolReportScript "iPhone SDK"}
|
export SELECTED=$iPhoneSDK; ${_xcodeToolReportScript "iPhone SDK"}
|
||||||
'';
|
'';
|
||||||
_xcodeVersion = builtins.replaceStrings ["xcode-wrapper-"] [""] xcodeWrapper.name;
|
_xcodeVersion = builtins.replaceStrings ["xcode-wrapper-"] [""] xcodeWrapper.name;
|
||||||
|
|
||||||
enforceXCodeAvailable = ''
|
enforceXCodeAvailable = ''
|
||||||
${_xcodeToolsTest}
|
${_xcodeToolsTest}
|
||||||
if [ $xcode -eq 0 ]; then
|
if [ $xcode -eq 0 ]; then
|
||||||
|
@ -26,6 +32,7 @@ let
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enforceiPhoneSDKAvailable = ''
|
enforceiPhoneSDKAvailable = ''
|
||||||
${_xcodeToolsTest}
|
${_xcodeToolsTest}
|
||||||
if [ $iPhoneSDK -eq 0 ]; then
|
if [ $iPhoneSDK -eq 0 ]; then
|
||||||
|
|
|
@ -1,19 +1,13 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
###################################################################################################
|
# WARNING: Impure setup, should be minimized.
|
||||||
#
|
# TODO: Replace this with yarn2nix.
|
||||||
# Impure setup (any setup here should be minimized and instead be moved to Nix for a pure setup)
|
|
||||||
#
|
|
||||||
###################################################################################################
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||||
|
source "${GIT_ROOT}/scripts/colors.sh"
|
||||||
|
|
||||||
RED='\033[0;31m'
|
|
||||||
GREEN='\033[0;32m'
|
|
||||||
YELLOW='\033[1;33m'
|
|
||||||
NC='\033[0m'
|
|
||||||
PLATFORM_FOLDER="desktop/js_files"
|
PLATFORM_FOLDER="desktop/js_files"
|
||||||
|
|
||||||
if [ ! -f package.json ] || [ $(readlink package.json) != "${PLATFORM_FOLDER}/package.json" ]; then
|
if [ ! -f package.json ] || [ $(readlink package.json) != "${PLATFORM_FOLDER}/package.json" ]; then
|
||||||
|
@ -33,4 +27,4 @@ mkdir -p "$GIT_ROOT/node_modules/"
|
||||||
# Leverage flock (file lock) utility to create an exclusive lock on node_modules/ while running 'yarn install'
|
# Leverage flock (file lock) utility to create an exclusive lock on node_modules/ while running 'yarn install'
|
||||||
flock "$GIT_ROOT/node_modules/" yarn install --frozen-lockfile
|
flock "$GIT_ROOT/node_modules/" yarn install --frozen-lockfile
|
||||||
|
|
||||||
echo -e "${GREEN}Finished!${NC}"
|
echo -e "${GRN}Finished!${RST}"
|
||||||
|
|
Loading…
Reference in New Issue