Commit Graph

32 Commits

Author SHA1 Message Date
Jakub Sokołowski 3e8647d626
nix: add ios-deploy package to ios shell
Also adds an assertion that gives a better error when trying to use an
`ios` Nix shell on an unsupported operating system.

Resolves:
https://github.com/status-im/status-mobile/issues/15695

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-04-20 20:17:38 +02:00
Jakub Sokołowski c3e52dbf47
ios: provide explicit NODE_ARGS in Nix shell
Some users have reported local `make run-ios` failures with errors like:
```
Command PhaseScriptExecution failed with a nonzero exit code
```
Where the actual error that can be found in `ios/logs/react-native-xcode.log` is:
```
node: bad option: --openssl-legacy-provider
```
Caused by a flag we apply to our pinned Node.js `18.9.1` to fix:
```
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
```
From: https://github.com/status-im/status-mobile/pull/15167

And the need for that should go away once we upgrade Node.js further.
But for now a decent fix is to not apply that flag directly in Xcode
config so as to avoid the `bad option` error when Xcode us called
outside of Nix context.

Fixes: https://github.com/status-im/status-mobile/issues/15631

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-04-13 09:36:42 +02:00
Jakub Sokołowski 4fe8b81bf6
ios: fix xcode using system Node.js version
As discovered in:
https://github.com/status-im/status-mobile/pull/15225

The attempt to fix this in:
https://github.com/status-im/status-mobile/pull/15180

But it doesn't appear to work, so instead I'm allowing an override of
`NODE_BINARY` variable and spetting it when defining the Nix shell.

The key things here are:

* Xcode injects its own paths into `PATH` which breaks Nix env.
* Combining Nix shells with `inputsFrom` does not inherit all vars.

It's important to set these variables in `shellHook` and not elsewhere.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-03-02 17:32:52 +01:00
Jakub Sokołowski e2169cbbd4
ios: use --openssl-legacy-provider with iOS builds
Fixes issue with following failure:
```
Failed to construct transformer:  Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:130:10)
    at stableHash (/Users/jenkins/workspace/status-mobile/platforms/ios/node_modules/metro-cache/src/stableHash.js:19:8)
    at JsTransformer.getCacheKey (/Users/jenkins/workspace/status-mobile/platforms/ios/node_modules/metro/src/JSTransformer/worker.js:471:7)
    at getTransformCacheKey (/Users/jenkins/workspace/status-mobile/platforms/ios/node_modules/metro/src/DeltaBundler/Transformer/getTransformCacheKey.js:39:29)
    at new Transformer (/Users/jenkins/workspace/status-mobile/platforms/ios/node_modules/metro/src/DeltaBundler/Transformer.js:147:28)
    at /Users/jenkins/workspace/status-mobile/platforms/ios/node_modules/metro/src/Bundler.js:54:29
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
```
https://roytuts.com/how-to-fix-err_ossl_evp_unsupported-in-react-js-application/

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-02-22 18:48:03 +01:00
Jakub Sokołowski 6a23f64550
nix: re-add step to call bundler install
Was removed in:
https://github.com/status-im/status-jenkins-lib/pull/48

But only causes issues when version of Ruby Gems change.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-10-12 11:07:56 +02:00
Jakub Sokołowski ca8b721135
nix: fix order of iOS shell components
Possible fix for errors like:
```
bundler: failed to load command: fastlane (/Users/jenkins/.bundle/ruby/2.7.0/bin/fastlane)
/Users/jenkins/.bundle/ruby/2.7.0/gems/fastlane-2.205.2/fastlane_core/lib/fastlane_core/ui/interface.rb:153:in `shell_error!': [!] Shell command exited with exit status 51 instead of 0. (FastlaneCore::Interface::FastlaneShellError)
```

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-08-30 09:27:49 +02:00
Jakub Sokołowski 8ec2f23203
nix: pass OPENSEA_API_KEY via saveAccountAndLogin
Here the injection of OpenSea API key was done at compile time:
https://github.com/status-im/status-mobile/commit/aa72ac57

But this makes `status-go` builds impure, and also prevents them from
being extracted from `status-mobile` into `status-go` repo.

Instead we pass the `OPENSEA_API_KEY` env variable to JS bundle at build
time, which is then passed to `status-go` via the
`Statusgo.saveAccountAndLogin` call in `saveAccountAndLogin`:
https://github.com/status-im/status-mobile/blob/51174f84/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java#L323-L327

Which sends `NodeConfig` that also contains `WalletConfig` which can
include `OpenseaAPIKey`:
```go
type WalletConfig struct {
    Enabled       bool
    OpenseaAPIKey string `json:"OpenseaAPIKey"`
}
```
https://github.com/status-im/status-go/blob/0135cc15/params/config.go#L510-L514

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-08-05 14:23:33 +02:00
Jakub Sokołowski 1f7fd17ff1
rename status-react to status-mobile
This way the name of the repo makes at least some sense and
matches the `status-desktop` repo naming.

Also updated `status-jenkins-lib` since it also contained
references to `status-react` repo and job names.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-07-17 14:46:16 +02:00
Jakub Sokołowski 61653888f8
nix: upgrade gomobile to 2022-05-04 version
Possible fix fix failing `status-go` builds:
https://github.com/status-im/status-react/issues/13346

Other notable upgrades:

* NodeJS `16.15.1` to `16.15.0`
* Yarn `1.22.18` to `1.22.19`
* Clojure `1.11.1.1113` to `1.11.1.1139`

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-06-20 19:01:14 +02:00
Jakub Sokołowski 5d9a29b3c8
nix: cleanup of unused variables
Mostly achieved by running via `nix-linter`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-05-31 12:03:20 +02:00
Roman Volosovskyi aa72ac5747
[#13016] Pass opensea key from env
Signed-off-by: andrey <motor4ik@gmail.com>
2022-03-21 13:59:35 +01:00
Jakub Sokołowski b27a53bdee
nix: fix order of starting iOS shell hooks
Fixes the `'Statusgo.h' file not found` error.

Resolves: https://github.com/status-im/status-react/issues/11951

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2021-04-09 09:50:13 +02:00
Jakub Sokołowski 112132aa94
drop all desktop related files and references
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-07-08 10:26:51 +02:00
Jakub Sokołowski 8a1704a064
nix: fix ios shell to use patched nodejs modules
This was missed in 604362958b

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-05-19 12:22:22 +02:00
Jakub Sokołowski 73a8992db7
nix: refactor loading of node.js modules
Changes:
- Drop `nix/mobile/android/maven-and-npm-deps/default.nix`
- Replace it with much simpler `nix/tools/patchNodeModules`
- Move Gradle patching tool to `nix/pkgs/patch-maven-srcs`
- Simplify it by using `gradle.deps` and patched node modules separately
- Change `TARGET` for `release-android` to `default`
- Move `mobile/reset-node_modules.sh` to `scripts/node_modules.sh`
- Move `nix/mobile/android/targets/release-android.nix` to `nix/mobile/android/release.nix`

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-05-15 16:19:27 +02:00
Jakub Sokołowski ed4d0a1ed9
nix: refactor updating Gradle dependencies
changes:
- Moved Gradle deps setup to `nix/deps/gradle`
- Dropped `nix/mobile/android/maven-and-npm-deps/maven`
- Used GNU Parallel to optimize `nix/deps/gradle/generate.sh`
- Move Maven+Node shell setup from `release-android.nix` to Android shell
- Moved AAPT2 patching to `nix/pkgs/aapt2`
- Drop `patchPhase` and `gradlew` use from `release-android.nix`
- Simplify symlinking `{mobile,desktop}/js_files/*`
- Add new `nodejs` shell and merge it with `clojure` and `gradle`
- Re-created Gradle deps files with new scripts:
  - `nix/deps/gradle/proj.list`
  - `nix/deps/gradle/deps.list`
  - `nix/deps/gradle/deps.urls`
  - `nix/deps/gradle/deps.nix`

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-05-14 09:46:30 +02:00
Jakub Sokołowski 45f1d58832
nix: simplify android release build
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-05-14 09:46:23 +02:00
Jakub Sokołowski fedb7131a9
nix: fix maven deps shell
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-05-06 11:32:37 +02:00
Jakub Sokołowski 42fb40476c
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>
2020-05-04 20:55:07 +02:00
Jakub Sokołowski 7b6b620ceb
nix: use overlays instead of packageOverrides
Changes:
- Add `nix/DETAILS.md` for more in-depth info
- Rename some of `config.status-im` variables
- Drop `env` argument for Android build
- Use `overlays` instead of `packageOverrides`
- Move the `pkgs` overlay to `nix/overlay.nix`
- Move `nix/status-go/utils.nix` to `nix/tools`
- Make `shell.nix` use the `shells.default` only
- Use `default.nix` as target for `nix/scripts/shell.sh`
- Make `nix/scripts/shell.sh` use `--attr` instead of `target`
- Drop the `target` argument in favour of using `--attr`
- Drop unnecessary `src` from `nix/mobile/ios/default.nix`
- Move `mkShell` and `mergeSh` under `lib`
- Move `patched-go` package to `nix/pkgs` directory
- Move `gomobile` package to `nix/pkgs` directory
- Move `ANDROID_ABI_SPLIT` to `config.status-im.android.abi-split`
- Move `ANDROID_ABI_INCLUDE to `config.status-im.android.abi-include`

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-04-29 11:53:33 +02:00
Jakub Sokołowski f75cb14588
refactor and simplify mkFilter, use more restrictive rules
This should reduce rebuilds of status-react-npm-gradle-modules

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-03-31 17:03:39 +02:00
Pedro Pombeiro e220ecbb0a
Cleanup
Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
2020-01-10 19:59:54 +01:00
Jakub Sokołowski aca703a011
major nix refactor
Changes:
- Adds a new `nix-gc` Makefile target for removing old packages
- Moves all `nix/*.sh` files to `nix/scripts/*.sh` to make things more tidy
- Renames `TARGET_OS` into `TARGET` and makes it effective only with `nix/scripts/shell.sh`
- Renames `target-os` Nix argument to just `target` and makes it effective only with `shell.nix`
- Drops `IN_CI_ENVIRONMENT` env variable which was useless
- Drops use of `target-os` argument outside of `shell.nix` (with few exceptions, but just in naming)
- `nix/platform.nix` has been made obsolete and removed
- Moves the definition of all major targets to `nix/targets.nix`
- Moves the definition of all major shells to `nix/shells.nix`
- Makes `default.nix` and `shell.nix` just thin wrappers around `nix/default.nix`
- `nix/nixpkgs-bootstrap.nix` has been moved to `nix/pkgs.nix`
- All package and tool overrides have been moved to `nix/pkgs.nix`
- Explicit passing of contents of `pkgs` has been removed in favor of `callPackage` doing it for us
- `nix/bootstrapped-shell.nix` has been moved to `nix/tools/mkShell.nix`
- A new `mergeSh` tool has been added to `pkgs` from `nix/tools/mergeSh.nix`
  - This tool is used to merge shells created using `mkShell`
- `mobile/targets/jsbundle.nix` has been moved to `mobile/android/jsbundle/default.nix`
- Moves `status-go` version sanitization to `nix/status-go/utils.nix`
- Renames version to rawVersion and versionName to cleanVersion in status-go derivation
- Ports nix/mobile/ios/install-pods-and-status-go.sh to Nix sub-shells
- Moves adjustment of `inotify/max_user_watches` out into `scripts/inotify_fix.sh`
- Makes iOS builds use the Nix version of Fastlane

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2019-12-12 18:51:21 +01:00
Jakub Sokołowski d6d33aceb0
add fastlane to ios shell
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2019-12-04 17:44:43 +01:00
Jakub Sokołowski f330392ccf
narrow match with UID, print persistent matching processes
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2019-11-30 14:47:06 +01:00
Pedro Pombeiro 8c7323e126
Use flock to create exclusive locks on node_modules/
Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
2019-09-13 17:46:18 +02:00
Pedro Pombeiro e3e8e218ad
Make root folder less busy
- Move `mobile_files` into `mobile/js_files`
- Move `desktop_files` into `desktop/js_files`

Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
2019-09-12 16:54:12 +02:00
Pedro Pombeiro 8209bf260c
Rename `package.json.orig` to `package.json`
- This allows 3rd party tools like Dependabot to inspect our dependencies
2019-09-12 16:16:43 +02:00
bitsikka 083cf07670
Ensure the pods are installed if `ios/Pods/` dir isn't there 2019-09-06 11:57:24 +02:00
Jakub Sokołowski 06dd2e5293
use wait-for.sh to fix nix/clean.sh race condition
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2019-08-21 18:53:00 -04:00
Pedro Pombeiro acf6278383
nix: Use nix/build.sh for release-android make target
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2019-07-26 16:01:06 -04:00
Pedro Pombeiro a7fd659d84
nix: Wrap gradle, npm packages, `lein prod-build` and `gradle assembleRelease` in Nix expressions to improve reproducible builds with constant build paths 2019-07-15 16:08:02 +02:00