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-02-15 08:04:03 +00:00
rev = " 1 5 6 2 3 a a c 6 e 8 c b f a 2 4 d 4 2 6 8 1 9 5 b c 8 e d a 7 3 0 3 e a 2 f f " ;
sha256 = " 0 c r j m s p k 6 5 r b p k l 3 k q c j 7 4 3 3 3 5 5 i 9 f y 5 3 0 l h c 4 8 g 2 c z 7 5 x j k 4 s x h " ;
2019-03-05 17:36:40 +00:00
} ) { config = { } ; } ,
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-05 17:36:40 +00:00
statusDesktop = callPackage ./scripts/lib/setup/nix/desktop { inherit target-os ; stdenv = _stdenv ; } ;
statusMobile = callPackage ./scripts/lib/setup/nix/mobile { inherit target-os ; stdenv = _stdenv ; } ;
2019-02-15 08:04:03 +00:00
nodeInputs = import ./scripts/lib/setup/nix/global-node-packages/output {
# The remaining dependencies come from Nixpkgs
inherit pkgs ;
inherit nodejs ;
} ;
nodePkgs = [
nodejs
python27 # for e.g. gyp
yarn
] ++ ( map ( x : nodeInputs . " ${ x } " ) ( builtins . attrNames nodeInputs ) ) ;
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
] ++ 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-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
./scripts/setup # we assume that if the Android SDK dir does not exist, make setup needs to be run
fi
2019-03-21 16:56:22 +00:00
set + e
2019-03-05 17:36:40 +00:00
'' ;
2019-03-26 12:50:59 +00:00
hardeningDisable = statusDesktop . hardeningDisable ;
2019-03-03 00:34:06 +00:00
}