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-05-07 10:21:39 +00:00
|
|
|
inherit (pkgs) lib stdenv mkShell;
|
2020-04-26 12:40:06 +00:00
|
|
|
|
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
|
2020-05-07 10:21:39 +00:00
|
|
|
default = mkShell {
|
2019-11-29 10:20:08 +00:00
|
|
|
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-15 23:08:10 +00:00
|
|
|
bash curl wget file unzip flock
|
2020-05-07 10:21:39 +00:00
|
|
|
git gnumake jq ncurses gnugrep parallel
|
2020-05-14 11:58:05 +00:00
|
|
|
lsof # used in start-react-native.sh
|
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-05-07 10:21:39 +00:00
|
|
|
# Combines with many other shells
|
|
|
|
node-sh = mkShell {
|
|
|
|
buildInputs = [ pkgs.androidPkgs ];
|
|
|
|
shellHook = ''
|
|
|
|
export STATUS_REACT_HOME=$(git rev-parse --show-toplevel)
|
2020-05-18 10:15:49 +00:00
|
|
|
$STATUS_REACT_HOME/nix/scripts/node_modules.sh ${pkgs.deps.nodejs-patched}
|
2020-05-07 10:21:39 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
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-05-07 10:21:39 +00:00
|
|
|
nodejs = node-sh;
|
2020-04-26 12:40:06 +00:00
|
|
|
|
2019-09-07 12:57:22 +00:00
|
|
|
# for calling clojure targets in CI or Makefile
|
2020-05-07 10:21:39 +00:00
|
|
|
clojure = mkShell {
|
|
|
|
buildInputs = with pkgs; [ clojure flock maven openjdk ];
|
|
|
|
inputsFrom = [ node-sh ];
|
2020-04-26 12:40:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# for 'make watchman-clean'
|
2020-05-07 10:21:39 +00:00
|
|
|
watchman = mkShell {
|
|
|
|
buildInputs = with pkgs; [ watchman ];
|
2020-04-26 12:40:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# for running fastlane commands alone
|
|
|
|
fastlane = targets.mobile.fastlane.shell;
|
|
|
|
|
2020-05-07 10:21:39 +00:00
|
|
|
# for running gradle by hand
|
|
|
|
gradle = mkShell {
|
2020-05-22 18:24:47 +00:00
|
|
|
buildInputs = with pkgs; [ gradle maven goMavenResolver ];
|
2020-05-07 10:21:39 +00:00
|
|
|
inputsFrom = [ node-sh ];
|
|
|
|
shellHook = ''
|
|
|
|
export STATUS_GO_ANDROID_LIBDIR="DUMMY"
|
2020-05-20 11:35:56 +00:00
|
|
|
export STATUS_NIX_MAVEN_REPO="${pkgs.deps.gradle}"
|
2020-05-07 10:21:39 +00:00
|
|
|
export ANDROID_SDK_ROOT="${pkgs.androidPkgs}"
|
|
|
|
export ANDROID_NDK_ROOT="${pkgs.androidPkgs}/ndk-bundle"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-04-26 12:40:06 +00:00
|
|
|
# for 'scripts/generate-keystore.sh'
|
2020-05-07 10:21:39 +00:00
|
|
|
keytool = mkShell {
|
|
|
|
buildInputs = with pkgs; [ openjdk8 ];
|
2020-04-26 12:40:06 +00:00
|
|
|
};
|
|
|
|
|
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-05-15 10:19:51 +00:00
|
|
|
status-go = targets.status-go.mobile.android;
|
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-05-07 10:21:39 +00:00
|
|
|
in {
|
|
|
|
inherit default;
|
|
|
|
} // lib.mapAttrs mergeDefaultShell shells
|