2019-11-29 10:20:08 +00:00
|
|
|
# This file defines custom shells as well as shortcuts
|
|
|
|
# for accessing more nested shells.
|
2020-01-08 14:41:07 +00:00
|
|
|
{
|
2019-11-29 10:20:08 +00:00
|
|
|
config ? {},
|
|
|
|
pkgs ? import ./pkgs.nix { inherit config; }
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2020-04-26 12:40:06 +00:00
|
|
|
inherit (pkgs) lib stdenv;
|
|
|
|
|
2019-11-29 10:20:08 +00:00
|
|
|
# everything else we define in nix/ dir
|
2020-01-08 14:41:07 +00:00
|
|
|
targets = pkgs.callPackage ./targets.nix { inherit config; };
|
2019-11-29 10:20:08 +00:00
|
|
|
|
|
|
|
# the default shell that is used when target is not specified
|
2020-04-26 12:40:06 +00:00
|
|
|
# it is also merged with all the other shells
|
2019-11-29 10:20:08 +00:00
|
|
|
default = pkgs.mkShell {
|
|
|
|
name = "status-react-shell"; # for identifying all shells
|
2020-04-26 12:40:06 +00:00
|
|
|
|
2019-11-29 10:20:08 +00:00
|
|
|
buildInputs = with pkgs; lib.unique ([
|
|
|
|
# core utilities that should always be present in a shell
|
2020-05-03 19:10:12 +00:00
|
|
|
bash curl wget file unzip flock
|
|
|
|
git gnumake jq ncurses gnugrep
|
2019-11-29 10:20:08 +00:00
|
|
|
# build specific utilities
|
2019-09-07 12:57:22 +00:00
|
|
|
clojure maven watchman
|
2019-11-29 10:20:08 +00:00
|
|
|
# other nice to have stuff
|
|
|
|
yarn nodejs python27
|
|
|
|
] # and some special cases
|
|
|
|
++ lib.optionals stdenv.isDarwin [ cocoapods clang ]
|
|
|
|
++ lib.optionals (!stdenv.isDarwin) [ gcc8 ]
|
|
|
|
);
|
|
|
|
|
2020-04-26 12:40:06 +00:00
|
|
|
# avoid terinal issues
|
|
|
|
TERM="xterm";
|
|
|
|
|
|
|
|
# default locale
|
|
|
|
LANG="en_US.UTF-8";
|
|
|
|
LANGUAGE="en_US.UTF-8";
|
|
|
|
|
2019-11-29 10:20:08 +00:00
|
|
|
# just a nicety for easy access to node scripts
|
|
|
|
shellHook = ''
|
2020-04-26 12:40:06 +00:00
|
|
|
export STATUS_REACT_HOME=$(git rev-parse --show-toplevel)
|
2019-11-29 10:20:08 +00:00
|
|
|
export PATH="$STATUS_REACT_HOME/node_modules/.bin:$PATH"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-04-26 12:40:06 +00:00
|
|
|
# An attrset for easier merging with default shell
|
2019-09-07 12:57:22 +00:00
|
|
|
shells = {
|
2020-04-26 12:40:06 +00:00
|
|
|
inherit default;
|
|
|
|
|
2019-09-07 12:57:22 +00:00
|
|
|
# for calling clojure targets in CI or Makefile
|
|
|
|
clojure = pkgs.mkShell {
|
|
|
|
buildInputs = with pkgs; [ clojure flock maven nodejs openjdk ];
|
2020-04-26 12:40:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# for 'make watchman-clean'
|
|
|
|
watchman = pkgs.mkShell {
|
|
|
|
buildInputs = [ pkgs.watchman ];
|
|
|
|
};
|
|
|
|
|
|
|
|
# for running fastlane commands alone
|
|
|
|
fastlane = targets.mobile.fastlane.shell;
|
|
|
|
|
|
|
|
# for 'scripts/generate-keystore.sh'
|
|
|
|
keytool = pkgs.mkShell {
|
|
|
|
buildInputs = [ pkgs.openjdk8 ];
|
|
|
|
};
|
|
|
|
|
2020-04-23 18:19:12 +00:00
|
|
|
# for targets that need 'adb' and other SDK/NDK tools
|
|
|
|
android-env = pkgs.androidShell;
|
2020-04-26 12:40:06 +00:00
|
|
|
|
|
|
|
# helpers for use with target argument
|
2020-04-23 18:19:12 +00:00
|
|
|
ios = targets.mobile.ios.shell;
|
|
|
|
android = targets.mobile.android.shell;
|
|
|
|
desktop = targets.desktop.shell;
|
2020-04-26 12:40:06 +00:00
|
|
|
linux = targets.desktop.linux.shell;
|
|
|
|
macos = targets.desktop.macos.shell;
|
2020-04-23 18:19:12 +00:00
|
|
|
windows = targets.desktop.macos.shell;
|
2020-04-26 12:40:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# for merging the default shell with others
|
2020-04-23 18:19:12 +00:00
|
|
|
mergeDefaultShell = (key: val: lib.mergeSh default [ val ]);
|
2020-04-26 12:40:06 +00:00
|
|
|
|
|
|
|
# values here can be selected using `nix-shell --attr shells.$TARGET default.nix`
|
2019-11-29 10:20:08 +00:00
|
|
|
# the nix/scripts/shell.sh wrapper does this for us and expects TARGET to be set
|
2020-04-26 12:40:06 +00:00
|
|
|
in lib.mapAttrs mergeDefaultShell shells
|