diff --git a/docs/nix_dev_env.md b/docs/nix_dev_env.md --- a/docs/nix_dev_env.md +++ b/docs/nix_dev_env.md @@ -81,7 +81,6 @@ - [Android SDK](./nix_mobile_setup.md#android-sdk) - [Android emulator](./nix_mobile_setup.md#android-emulator) - [Debugging tools](./nix_mobile_setup.md#debugging-tools) - - [Homebrew](./nix_mobile_setup.md#homebrew) - [Reactotron](./nix_mobile_setup.md#reactotron) # Development environment diff --git a/docs/nix_mobile_setup.md b/docs/nix_mobile_setup.md --- a/docs/nix_mobile_setup.md +++ b/docs/nix_mobile_setup.md @@ -121,10 +121,6 @@ ## Debugging tools -### Homebrew - -Install [Homebrew](https://brew.sh/), a package manager for macOS. It’s necessary for some of the following steps. - ### Reactotron Reactotron is an event tracker and logger that can be used to aid in debugging on React Native. diff --git a/nix/dev-shell.nix b/nix/dev-shell.nix --- a/nix/dev-shell.nix +++ b/nix/dev-shell.nix @@ -135,6 +135,8 @@ redis_pid=$! wait "$mariadb_pid" "$redis_pid" + + ${../scripts}/install_homebrew_macos.sh '' + '' # Render default configuration for keyserver diff --git a/scripts/install_homebrew_macos.sh b/scripts/install_homebrew_macos.sh new file mode 100755 --- /dev/null +++ b/scripts/install_homebrew_macos.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Currently, this script only works on macOS as it assumes homebrew usage +if ! [[ "$OSTYPE" == 'darwin'* ]]; then + echo "This script is only meant to be ran on macOS" >&2 + exit 1 +fi + +if ! command -v brew >/dev/null; then + echo "Installing Homebrew..." >&2 + + bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +fi