2019-04-03 11:06:42 +00:00
# target-os = [ 'windows' 'linux' 'macos' 'android' 'ios' ]
{ system ? builtins . currentSystem
, config ? { } , overlays ? [ ]
, pkgs ? ( import <nixpkgs> { inherit system config overlays ; } )
, target-os } :
with pkgs ;
let
sanitized-target-os =
if ( builtins . any ( os : target-os == os ) [ " l i n u x " " a n d r o i d " " w i n d o w s " " m a c o s " " i o s " " a l l " ] )
then target-os
else throw " U n k n o w n v a l u e f o r t a r g e t - o s : ' ${ target-os } ' " ;
targetDesktop = {
" l i n u x " = true ;
" w i n d o w s " = true ;
" m a c o s " = true ;
" a l l " = true ;
} . ${ sanitized-target-os } or false ;
targetMobile = {
" a n d r o i d " = true ;
" i o s " = true ;
" a l l " = true ;
} . ${ sanitized-target-os } or false ;
# 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 = stdenvNoCC ;
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 ; } ;
2019-04-11 15:04:43 +00:00
nodejs' = pkgs . nodejs-10_x ;
yarn' = yarn . override { nodejs = nodejs' ; } ;
2019-04-03 11:06:42 +00:00
nodeInputs = import ./nix/global-node-packages/output {
# The remaining dependencies come from Nixpkgs
2019-04-11 15:04:43 +00:00
inherit pkgs ;
nodejs = nodejs' ;
2019-04-03 11:06:42 +00:00
} ;
2019-04-11 15:04:43 +00:00
nodePkgBuildInputs = [
nodejs'
2019-04-03 11:06:42 +00:00
python27 # for e.g. gyp
2019-04-11 15:04:43 +00:00
yarn'
2019-04-03 11:06:42 +00:00
] ++ ( map ( x : nodeInputs . " ${ x } " ) ( builtins . attrNames nodeInputs ) ) ;
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 " ] ;
} ;
in _stdenv . mkDerivation rec {
name = " s t a t u s - r e a c t - b u i l d - e n v " ;
buildInputs = with _stdenv ; [
clojure
leiningen
maven
watchman
status-go
2019-04-11 15:04:43 +00:00
] ++ nodePkgBuildInputs
2019-04-03 11:06:42 +00:00
++ lib . optional isDarwin cocoapods
++ lib . optional ( ! isDarwin ) gcc7
++ lib . optionals targetDesktop statusDesktop . buildInputs
++ lib . optionals targetMobile statusMobile . buildInputs ;
shellHook =
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
'' +
lib . optionalString targetDesktop statusDesktop . shellHook +
lib . optionalString targetMobile statusMobile . shellHook ;
hardeningDisable = status-go . hardeningDisable ;
}