2019-03-05 17:36:40 +00:00
# target-os = [ 'windows' 'linux' 'macos' 'android' 'ios' ]
{ pkgs ? import ( ( import <nixpkgs> { } ) . fetchFromGitHub {
2019-02-15 08:04:03 +00:00
owner = " s t a t u s - i m " ;
2019-02-01 10:44:51 +00:00
repo = " n i x p k g s " ;
2019-03-25 16:35:01 +00:00
rev = " d b 4 9 2 b 6 1 5 7 2 2 5 1 c 2 8 6 6 f 6 b 5 e 6 e 9 4 e 9 d 7 0 e 7 d 3 0 2 1 " ;
sha256 = " 1 8 8 r 7 g b c r x i 2 0 n j 6 x h 9 b m d f 3 l b j w b 9 4 v 9 s 0 w p a c l 7 q 3 9 g 1 f c a 6 6 h " ;
} ) { config = { android_sdk . accept_license = true ; } ; } ,
2019-03-05 17:36:40 +00:00
target-os ? " " } :
2019-02-01 10:44:51 +00:00
2019-03-05 17:36:40 +00:00
with pkgs ;
2019-02-15 08:04:03 +00:00
let
2019-03-05 17:36:40 +00:00
targetDesktop = {
" l i n u x " = true ;
" w i n d o w s " = true ;
" m a c o s " = true ;
" " = true ;
} . ${ target-os } or false ;
targetMobile = {
" a n d r o i d " = true ;
" i o s " = true ;
" " = true ;
} . ${ target-os } or false ;
2019-03-26 12:50:59 +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 = if target-os == " i o s " || target-os == " " then stdenvNoCC else stdenv ;
2019-03-25 16:35:01 +00:00
statusDesktop = callPackage ./nix/desktop { inherit target-os ; stdenv = _stdenv ; } ;
statusMobile = callPackage ./nix/mobile { inherit target-os status-go ; androidPkgs = androidComposition ; stdenv = _stdenv ; } ;
status-go = callPackage ./nix/status-go { inherit ( xcodeenv ) composeXcodeWrapper ; inherit xcodewrapperArgs ; androidPkgs = androidComposition ; } ;
nodeInputs = import ./nix/global-node-packages/output {
2019-02-15 08:04:03 +00:00
# The remaining dependencies come from Nixpkgs
2019-03-25 16:35:01 +00:00
inherit pkgs nodejs ;
2019-02-15 08:04:03 +00:00
} ;
nodePkgs = [
nodejs
python27 # for e.g. gyp
yarn
] ++ ( map ( x : nodeInputs . " ${ x } " ) ( builtins . attrNames nodeInputs ) ) ;
2019-03-25 16:35:01 +00:00
xcodewrapperArgs = {
version = " 1 0 . 1 " ;
} ;
xcodeWrapper = xcodeenv . composeXcodeWrapper xcodewrapperArgs ;
androidComposition = androidenv . composeAndroidPackages {
toolsVersion = " 2 6 . 1 . 1 " ;
platformToolsVersion = " 2 8 . 0 . 2 " ;
buildToolsVersions = [ " 2 8 . 0 . 3 " ] ;
includeEmulator = false ;
platformVersions = [ " 2 6 " " 2 7 " ] ;
includeSources = false ;
includeDocs = false ;
includeSystemImages = false ;
systemImageTypes = [ " d e f a u l t " ] ;
abiVersions = [ " a r m e a b i - v 7 a " ] ;
lldbVersions = [ " 2 . 0 . 2 5 5 8 1 4 4 " ] ;
cmakeVersions = [ " 3 . 6 . 4 1 1 1 4 5 9 " ] ;
includeNDK = true ;
ndkVersion = " 1 9 . 2 . 5 3 4 5 6 0 0 " ;
useGoogleAPIs = false ;
useGoogleTVAddOns = false ;
includeExtras = [ " e x t r a s ; a n d r o i d ; m 2 r e p o s i t o r y " " e x t r a s ; g o o g l e ; m 2 r e p o s i t o r y " ] ;
} ;
2019-02-01 10:44:51 +00:00
2019-02-15 08:04:03 +00:00
in _stdenv . mkDerivation rec {
name = " e n v " ;
env = buildEnv { name = name ; paths = buildInputs ; } ;
buildInputs = with _stdenv ; [
2019-02-28 10:56:58 +00:00
bash
2019-02-15 08:04:03 +00:00
clojure
curl
2019-02-28 10:56:58 +00:00
git
2019-02-15 08:04:03 +00:00
jq
leiningen
lsof # used in scripts/start-react-native.sh
maven
ncurses
ps # used in scripts/start-react-native.sh
watchman
unzip
wget
2019-03-25 16:35:01 +00:00
status-go
2019-02-15 08:04:03 +00:00
] ++ nodePkgs
++ lib . optional isDarwin cocoapods
2019-03-05 17:36:40 +00:00
++ lib . optional targetDesktop statusDesktop . buildInputs
++ lib . optional targetMobile statusMobile . buildInputs ;
shellHook =
2019-03-21 16:56:22 +00:00
''
set - e
'' +
2019-03-25 16:35:01 +00:00
status-go . shellHook +
''
export STATUS_GO_INCLUDEDIR = $ { status-go } /include
export STATUS_GO_LIBDIR = $ { status-go } /lib
export STATUS_GO_BINDIR = $ { status-go . bin } /bin
'' +
2019-03-05 17:36:40 +00:00
lib . optionalString targetDesktop statusDesktop . shellHook +
lib . optionalString targetMobile statusMobile . shellHook +
''
if [ - n " $ A N D R O I D _ S D K _ R O O T " ] && [ ! - d " $ A N D R O I D _ S D K _ R O O T " ] ; then
2019-04-09 19:02:39 +00:00
./scripts/setup # we assume that if the Android SDK dir does not exist, setup script needs to be run
2019-03-05 17:36:40 +00:00
fi
2019-03-21 16:56:22 +00:00
set + e
2019-03-05 17:36:40 +00:00
'' ;
2019-03-25 16:35:01 +00:00
hardeningDisable = status-go . hardeningDisable ;
2019-03-03 00:34:06 +00:00
}