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 } :
2019-05-17 08:55:24 +00:00
let
platform = pkgs . callPackage ./nix/platform.nix { inherit target-os ; } ;
# 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)
2019-07-04 14:49:21 +00:00
stdenv = pkgs . stdenvNoCC ;
2019-05-17 08:55:24 +00:00
gradle = pkgs . gradle_4_10 ;
2019-05-14 17:29:36 +00:00
baseGo = pkgs . go_1_11 ;
go = pkgs . callPackage ./nix/patched-go { inherit baseGo ; } ;
2019-06-11 09:44:17 +00:00
buildGoPackage = pkgs . buildGoPackage . override { inherit go ; } ;
2019-05-14 17:29:36 +00:00
statusDesktop = pkgs . callPackage ./nix/desktop { inherit target-os stdenv status-go pkgs nodejs ; inherit ( pkgs ) darwin ; go = baseGo ; } ;
2019-07-04 14:49:21 +00:00
statusMobile = pkgs . callPackage ./nix/mobile { inherit target-os config stdenv pkgs nodejs status-go gradle ; inherit ( pkgs . xcodeenv ) composeXcodeWrapper ; } ;
2019-06-11 09:44:17 +00:00
status-go = pkgs . callPackage ./nix/status-go { inherit target-os go buildGoPackage ; inherit ( pkgs . xcodeenv ) composeXcodeWrapper ; inherit ( statusMobile ) xcodewrapperArgs ; androidPkgs = statusMobile . androidComposition ; } ;
2019-07-04 14:49:21 +00:00
nodejs = pkgs . nodejs-10_x ;
yarn = pkgs . yarn . override { inherit nodejs ; } ;
2019-05-17 08:55:24 +00:00
nodePkgBuildInputs = [
2019-07-04 14:49:21 +00:00
nodejs
2019-05-17 08:55:24 +00:00
pkgs . python27 # for e.g. gyp
2019-07-04 14:49:21 +00:00
yarn
2019-05-22 16:04:45 +00:00
] ;
2019-05-17 08:55:24 +00:00
selectedSources =
2019-07-04 14:49:21 +00:00
stdenv . lib . optional platform . targetDesktop statusDesktop ++
stdenv . lib . optional platform . targetMobile statusMobile ;
2019-04-03 11:06:42 +00:00
2019-07-04 14:49:21 +00:00
in with stdenv ; mkDerivation rec {
2019-05-17 08:55:24 +00:00
name = " s t a t u s - r e a c t - b u i l d - e n v " ;
2019-04-03 11:06:42 +00:00
2019-05-17 08:55:24 +00:00
buildInputs = with pkgs ; [
clojure
leiningen
maven
watchman
] ++ nodePkgBuildInputs
++ lib . optional isDarwin cocoapods
++ lib . optional ( isDarwin && ! platform . targetIOS ) clang
2019-05-14 17:29:36 +00:00
++ lib . optional ( ! isDarwin ) gcc8
2019-05-17 08:55:24 +00:00
++ lib . catAttrs " b u i l d I n p u t s " selectedSources ;
shellHook = lib . concatStrings ( lib . catAttrs " s h e l l H o o k " selectedSources ) ;
}