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 = "status-im";
|
2019-02-01 10:44:51 +00:00
|
|
|
repo = "nixpkgs";
|
2019-02-15 08:04:03 +00:00
|
|
|
rev = "15623aac6e8cbfa24d4268195bc8eda7303ea2ff";
|
|
|
|
sha256 = "0crjmspk65rbpkl3kqcj7433355i9fy530lhc48g2cz75xjk4sxh";
|
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 = {
|
|
|
|
"linux" = true;
|
|
|
|
"windows" = true;
|
|
|
|
"macos" = true;
|
|
|
|
"" = true;
|
|
|
|
}.${target-os} or false;
|
|
|
|
targetMobile = {
|
|
|
|
"android" = true;
|
|
|
|
"ios" = true;
|
|
|
|
"" = true;
|
|
|
|
}.${target-os} or false;
|
2019-02-15 08:04:03 +00:00
|
|
|
_stdenv = stdenvNoCC; # TODO: Try to use stdenv for Darwin
|
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 = "env";
|
|
|
|
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 isLinux gcc7
|
|
|
|
++ 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 "$ANDROID_SDK_ROOT" ] && [ ! -d "$ANDROID_SDK_ROOT" ]; 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-03 00:34:06 +00:00
|
|
|
}
|