2019-12-04 13:14:55 +00:00
{ config , stdenv , stdenvNoCC , callPackage , mkShell , fastlane , cocoapods ,
2019-09-13 13:45:24 +00:00
xcodeWrapper , mkFilter , fetchurl , flock , nodejs , bash , zlib , procps ,
2019-06-04 16:50:29 +00:00
status-go , projectNodePackage } :
let
inherit ( stdenv . lib ) catAttrs concatStrings unique ;
createMobileFilesSymlinks = root : ''
# Set up symlinks to mobile enviroment in project root
2019-09-12 14:30:56 +00:00
ln - sf $ { root } /mobile/js_files/package.json $ { root } /package.json
ln - sf $ { root } /mobile/js_files/metro.config.js $ { root } /metro.config.js
ln - sf $ { root } /mobile/js_files/yarn.lock $ { root } /yarn.lock
2019-06-04 16:50:29 +00:00
'' ;
src =
let path = ./../../.. ;
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 ;
2019-07-15 16:34:33 +00:00
name = " s t a t u s - r e a c t - s o u r c e - n p m - d e p s " ;
2019-06-04 16:50:29 +00:00
filter =
# Keep this filter as restrictive as possible in order to avoid unnecessary rebuilds and limit closure size
mkFilter {
2019-09-12 14:30:56 +00:00
dirRootsToInclude = [ " m o b i l e / j s _ f i l e s " ] ;
2019-06-04 16:50:29 +00:00
dirsToExclude = [ " . g i t " " . s v n " " C V S " " . h g " ] ;
filesToInclude = [ " . b a b e l r c " ] ;
root = path ;
} ;
} ;
2019-12-04 13:14:55 +00:00
selectedSources = [ fastlane status-go ] ;
2019-06-04 16:50:29 +00:00
2019-09-13 13:45:24 +00:00
buildInputs = unique ( [
2019-12-04 13:14:55 +00:00
cocoapods
fastlane . drv
2019-09-13 13:45:24 +00:00
xcodeWrapper
flock # used in reset-node_modules.sh
procps
] ++ catAttrs " b u i l d I n p u t s " selectedSources ) ;
2019-12-04 13:14:55 +00:00
2019-06-04 16:50:29 +00:00
shellHook = ''
$ { status-go . shellHook }
2019-12-04 13:14:55 +00:00
$ { fastlane . shellHook }
2019-06-04 16:50:29 +00:00
$ { createMobileFilesSymlinks " $ S T A T U S _ R E A C T _ H O M E " }
$ STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh " ${ projectNodePackage } " && \
$ STATUS_REACT_HOME/nix/mobile/ios/install-pods-and-status-go.sh || \
exit
'' ;
2019-12-04 13:14:55 +00:00
in {
inherit xcodeWrapper shellHook buildInputs ;
2019-06-04 16:50:29 +00:00
# TARGETS
2019-12-04 13:14:55 +00:00
shell = mkShell {
inherit buildInputs shellHook ;
} ;
2019-06-04 16:50:29 +00:00
}