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
|
2022-08-29 16:26:14 +00:00
|
|
|
nodejs-sh = targets.mobile.ios.nodejs-sh;
|
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;
|
|
|
|
|
2022-08-29 16:26:14 +00:00
|
|
|
nodejs = nodejs-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 {
|
2022-10-19 12:54:01 +00:00
|
|
|
buildInputs = with pkgs; [ clojure flock maven openjdk clj-kondo ];
|
2022-08-29 16:26:14 +00:00
|
|
|
inputsFrom = [ nodejs-sh ];
|
2021-03-01 14:36:59 +00:00
|
|
|
# CLASSPATH from clojure deps with 'src' appended to find local sources.
|
|
|
|
shellHook = with pkgs; ''
|
|
|
|
export CLASS_PATH="$(find ${deps.clojure} -iname '*.jar' | tr '\n' ':')src"
|
|
|
|
'';
|
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 ];
|
2022-08-29 16:26:14 +00:00
|
|
|
inputsFrom = [ nodejs-sh ];
|
2020-05-07 10:21:39 +00:00
|
|
|
shellHook = ''
|
|
|
|
export STATUS_GO_ANDROID_LIBDIR="DUMMY"
|
2020-05-20 11:35:56 +00:00
|
|
|
export STATUS_NIX_MAVEN_REPO="${pkgs.deps.gradle}"
|
2021-10-21 21:35:43 +00:00
|
|
|
export ANDROID_SDK_ROOT="${pkgs.androidPkgs.sdk}"
|
|
|
|
export ANDROID_NDK_ROOT="${pkgs.androidPkgs.ndk}"
|
2020-05-07 10:21:39 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-04-26 12:40:06 +00:00
|
|
|
# for 'scripts/generate-keystore.sh'
|
2020-05-07 10:21:39 +00:00
|
|
|
keytool = mkShell {
|
2022-04-22 08:20:01 +00:00
|
|
|
buildInputs = with pkgs; [ openjdk8 apksigner ];
|
2020-04-26 12:40:06 +00:00
|
|
|
};
|
|
|
|
|
2022-09-29 10:29:28 +00:00
|
|
|
# for targets needing 'adb', 'apkanalyzer' and other SDK/NDK tools
|
|
|
|
android-sdk = 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
|
2022-05-26 09:11:34 +00:00
|
|
|
mergeDefaultShell = (_: 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
|