2019-11-29 10:20:08 +00:00
|
|
|
# This file defines custom shells as well as shortcuts
|
|
|
|
# for accessing more nested shells.
|
2020-06-05 09:23:22 +00:00
|
|
|
{ config ? {}
|
|
|
|
, pkgs ? import ./pkgs.nix { inherit config; } }:
|
2019-11-29 10:20:08 +00:00
|
|
|
|
|
|
|
let
|
2020-06-05 09:23:22 +00:00
|
|
|
inherit (pkgs) lib mkShell callPackage;
|
2020-04-26 12:40:06 +00:00
|
|
|
|
2019-11-29 10:20:08 +00:00
|
|
|
# everything else we define in nix/ dir
|
2020-06-05 09:23:22 +00:00
|
|
|
targets = callPackage ./targets.nix { inherit config; };
|
2019-11-29 10:20:08 +00:00
|
|
|
|
2020-06-05 09:23:22 +00:00
|
|
|
# the default shell with most commonly used tools
|
|
|
|
default = callPackage ./shell.nix { };
|
2019-11-29 10:20:08 +00:00
|
|
|
|
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-06-05 09:23:22 +00:00
|
|
|
inherit default;
|
|
|
|
|
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;
|
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-06-05 09:23:22 +00:00
|
|
|
in lib.mapAttrs mergeDefaultShell shells
|