2019-04-03 11:06:42 +00:00
{ system ? builtins . currentSystem
2019-04-11 12:48:53 +00:00
, config ? { android_sdk . accept_license = true ; } , overlays ? [ ]
2019-04-03 11:06:42 +00:00
, pkgs ? ( import <nixpkgs> { inherit system config overlays ; } )
, target-os } :
with pkgs ;
let
sanitized-target-os =
2019-04-12 08:36:30 +00:00
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 " " d a r w i n " " i o s " " a l l " ] )
2019-04-03 11:06:42 +00:00
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 } ' " ;
2019-04-12 08:36:30 +00:00
# based on the value passed in through target-os, check if we're targetting a desktop platform
2019-04-03 11:06:42 +00:00
targetDesktop = {
" l i n u x " = true ;
" w i n d o w s " = true ;
" m a c o s " = true ;
2019-04-12 08:36:30 +00:00
" d a r w i n " = true ;
2019-04-03 11:06:42 +00:00
" a l l " = true ;
} . ${ sanitized-target-os } or false ;
2019-04-12 08:36:30 +00:00
# based on the value passed in through target-os, check if we're targetting a mobile platform
2019-04-03 11:06:42 +00:00
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 ; } ;
2019-04-12 07:38:08 +00:00
statusMobile = callPackage ./nix/mobile { inherit target-os config ; status-go = status-go . package ; stdenv = _stdenv ; } ;
2019-04-11 12:48:53 +00:00
status-go = callPackage ./nix/status-go { inherit ( xcodeenv ) composeXcodeWrapper ; inherit ( statusMobile ) xcodewrapperArgs ; androidPkgs = statusMobile . 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 ) ) ;
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
2019-04-12 07:38:08 +00:00
status-go . package
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 +
lib . optionalString targetDesktop statusDesktop . shellHook +
lib . optionalString targetMobile statusMobile . shellHook ;
hardeningDisable = status-go . hardeningDisable ;
}