2019-11-29 10:20:08 +00:00
{ callPackage , lib , stdenv , mkShell , mergeSh , mkFilter ,
xcodeWrapper , projectNodePackage , status-go ,
flock , procps , watchman , bundler , fastlane } :
2019-06-04 16:50:29 +00:00
let
2019-11-29 10:20:08 +00:00
inherit ( lib ) catAttrs unique ;
2019-06-04 16:50:29 +00:00
2019-11-29 10:20:08 +00:00
pod = callPackage ./pod-shell.nix { } ;
status-go-shell = callPackage ./status-go-shell.nix { inherit status-go ; } ;
selectedSources = [ status-go fastlane ] ;
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-09-13 13:45:24 +00:00
buildInputs = unique ( [
2019-11-29 10:20:08 +00:00
xcodeWrapper watchman bundler procps
2019-09-13 13:45:24 +00:00
flock # used in reset-node_modules.sh
] ++ 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 = ''
2019-11-29 10:20:08 +00:00
pushd " $ S T A T U S _ R E A C T _ H O M E " > /dev/null
{
# Set up symlinks to mobile enviroment in project root
ln - sf ./mobile/js_files/metro.config.js ./metro.config.js
ln - sf ./mobile/js_files/package.json ./package.json
ln - sf ./mobile/js_files/yarn.lock ./yarn.lock
# check if node modules changed and if so install them
./nix/mobile/reset-node_modules.sh " ${ projectNodePackage } "
}
popd > /dev/null
2019-06-04 16:50:29 +00:00
'' ;
2019-11-29 10:20:08 +00:00
localShell = mkShell {
2019-12-04 13:14:55 +00:00
inherit buildInputs shellHook ;
} ;
2019-11-29 10:20:08 +00:00
in {
inherit shellHook buildInputs pod ;
shell = mergeSh localShell [
fastlane . shell status-go-shell pod . shell
] ;
2019-06-04 16:50:29 +00:00
}