mirror of
https://github.com/status-im/status-react.git
synced 2025-01-10 02:56:07 +00:00
Jakub Sokołowski
5903cf73fb
This passing of Watchman socket was implemented in order to avoid this: ``` Error: EMFILE: too many open files, watch at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:204:21) Emitted 'error' event on NodeWatcher instance at: at NodeWatcher.checkedEmitError (/private/tmp/nix-build-status-mobile-build-nightly-android.drv-0/node_modules/sane/src/node_watcher.js:143:12) at FSWatcher.emit (node:events:527:28) at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:210:12) { errno: -24, syscall: 'watch', code: 'EMFILE', filename: null } ``` Which is caused by `jest-haste-map` used by `metro` starting to watch the filesystem for file changes, which is pointless when doing a one-off build using Nix. But by setting `CI=true` we can make `metro` not start this waching of files in the first place, removing the need for use of Watchman entirely. By entirely dropping use of Watchman we also fix the following issue: ``` [cli] unable to talk to your watchman on /tmp/tmp-status-mobile-ABC/jenkins-state/sock! (Permission denied) ``` Which happens on multi-user Nix installations becuase the user that the Nix build is executed as is not the same as the user that starts Watchman and creates the socket file. Issue: https://github.com/status-im/status-mobile/issues/13783 Signed-off-by: Jakub Sokołowski <jakub@status.im>
40 lines
958 B
Nix
40 lines
958 B
Nix
{ pkgs, deps, callPackage, mkShell
|
|
, status-go, androidPkgs, androidShell }:
|
|
|
|
let
|
|
# Import a jsbundle compiled out of clojure codebase
|
|
jsbundle = callPackage ./jsbundle { };
|
|
|
|
release = callPackage ./release.nix { inherit jsbundle status-go; };
|
|
in {
|
|
# TARGETS
|
|
inherit release jsbundle;
|
|
|
|
shell = mkShell {
|
|
buildInputs = with pkgs; [
|
|
openjdk
|
|
gradle
|
|
lsof # used in start-react-native.sh
|
|
flock # used in nix/scripts/node_modules.sh
|
|
];
|
|
|
|
inputsFrom = [
|
|
release
|
|
androidShell
|
|
];
|
|
|
|
shellHook = ''
|
|
export ANDROID_SDK_ROOT="${androidPkgs.sdk}"
|
|
export ANDROID_NDK_ROOT="${androidPkgs.ndk}"
|
|
|
|
export STATUS_NIX_MAVEN_REPO="${deps.gradle}"
|
|
|
|
# required by some makefile targets
|
|
export STATUS_GO_ANDROID_LIBDIR=${status-go}
|
|
|
|
# check if node modules changed and if so install them
|
|
$STATUS_MOBILE_HOME/nix/scripts/node_modules.sh ${deps.nodejs-patched}
|
|
'';
|
|
};
|
|
}
|