2019-06-04 16:50:29 +00:00
{ system ? builtins . currentSystem
, config ? { android_sdk . accept_license = true ; } , overlays ? [ ]
, pkgs ? ( import <nixpkgs> { inherit system config overlays ; } )
, target-os } :
let
inherit ( stdenv ) isDarwin ;
inherit ( stdenv . lib ) catAttrs concatStrings optional unique ;
platform = pkgs . callPackage ./platform.nix { inherit target-os ; } ;
# Declare a specialized mkShell function which adds some bootstrapping
# so that e.g. STATUS_REACT_HOME is automatically available in the shell
2019-07-29 08:33:35 +00:00
mkShell = ( import ./bootstrapped-shell.nix {
inherit stdenv target-os ;
inherit ( pkgs ) mkShell git ;
} ) ;
2019-06-04 16:50:29 +00:00
# TODO: Try to use stdenv for iOS. The problem is with building iOS as the build is trying to pass parameters to Apple's ld that are meant for GNU's ld (e.g. -dynamiclib)
stdenv = pkgs . stdenvNoCC ;
maven = pkgs . maven ;
2019-09-27 14:21:29 +00:00
baseGo = pkgs . go_1_12 ;
2019-06-04 16:50:29 +00:00
go = pkgs . callPackage ./patched-go { inherit baseGo ; } ;
buildGoPackage = pkgs . buildGoPackage . override { inherit go ; } ;
2019-07-19 18:42:16 +00:00
desktop = pkgs . callPackage ./desktop { inherit target-os stdenv status-go pkgs go nodejs ; inherit ( pkgs ) darwin ; } ;
2019-07-23 20:54:17 +00:00
mobile = pkgs . callPackage ./mobile { inherit target-os config stdenv pkgs mkShell nodejs yarn status-go maven localMavenRepoBuilder mkFilter ; inherit ( pkgs . xcodeenv ) composeXcodeWrapper ; } ;
2019-11-13 13:12:02 +00:00
status-go = pkgs . callPackage ./status-go { inherit target-os config go buildGoPackage ; inherit ( mobile . ios ) xcodeWrapper ; androidPkgs = mobile . android . androidComposition ; } ;
2019-06-04 16:50:29 +00:00
# mkFilter is a function that allows filtering a directory structure (used for filtering source files being captured in a closure)
mkFilter = import ./tools/mkFilter.nix { inherit ( stdenv ) lib ; } ;
2019-07-29 08:33:35 +00:00
localMavenRepoBuilder =
pkgs . callPackage ./tools/maven/maven-repo-builder.nix {
inherit ( pkgs ) stdenv ;
} ;
2019-06-04 16:50:29 +00:00
nodejs = pkgs . nodejs-10_x ;
yarn = pkgs . yarn . override { inherit nodejs ; } ;
selectedSources =
optional platform . targetDesktop desktop ++
optional platform . targetMobile mobile ;
# TARGETS
leiningen-shell = mkShell {
2019-09-13 13:45:24 +00:00
buildInputs = with pkgs ; [ clojure leiningen flock maven nodejs openjdk ] ;
2019-06-04 16:50:29 +00:00
shellHook =
if target-os == " a n d r o i d " then mobile . android . shellHook else
if target-os == " i o s " then mobile . ios . shellHook else " " ;
} ;
watchman-shell = mkShell {
buildInputs = with pkgs ; [ watchman ] ;
} ;
in {
# CHILD DERIVATIONS
2019-07-22 03:31:47 +00:00
inherit mobile status-go ;
2019-06-04 16:50:29 +00:00
# TARGETS
leiningen = {
shell = leiningen-shell ;
} ;
watchman = {
shell = watchman-shell ;
} ;
shell = {
buildInputs = unique ( [
2019-07-29 08:33:35 +00:00
nodejs
pkgs . python27 # for e.g. gyp
yarn
] ++ optional isDarwin pkgs . cocoapods
2019-06-04 16:50:29 +00:00
++ optional ( isDarwin && ! platform . targetIOS ) pkgs . clang
++ optional ( ! isDarwin ) pkgs . gcc8
++ catAttrs " b u i l d I n p u t s " selectedSources ) ;
shellHook = ''
export PATH = " $ S T A T U S _ R E A C T _ H O M E / n o d e _ m o d u l e s / . b i n : $ P A T H "
$ { concatStrings ( catAttrs " s h e l l H o o k " selectedSources ) }
'' ;
} ;
}