Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3514439
D4948.id18412.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D4948.id18412.diff
View Options
diff --git a/nix/dev-shell.nix b/nix/dev-shell.nix
--- a/nix/dev-shell.nix
+++ b/nix/dev-shell.nix
@@ -32,6 +32,7 @@
, pkg-config
, protobuf_3_15_cmake
, python3
+, rabbitmq-server
, redis
, redis-up
, rustup
@@ -82,6 +83,7 @@
pkg-config
protobuf_3_15_cmake
grpc
+ rabbitmq-server # runtime service
] ++ lib.optionals stdenv.isDarwin [
cocoapods # needed for ios
bundler
diff --git a/nix/overlay.nix b/nix/overlay.nix
--- a/nix/overlay.nix
+++ b/nix/overlay.nix
@@ -89,6 +89,8 @@
];
});
+ rabbitmq-up = prev.callPackage ./rabbitmq-up-mac.nix { };
+
# Ensure that yarn is using the pinned version
yarn = prev.yarn.override (_: {
nodejs = final.nodejs-16_x-openssl_1_1;
diff --git a/nix/rabbitmq-up-mac.nix b/nix/rabbitmq-up-mac.nix
new file mode 100644
--- /dev/null
+++ b/nix/rabbitmq-up-mac.nix
@@ -0,0 +1,44 @@
+{ lib
+, rabbitmq-server
+, writeShellApplication
+}:
+
+let
+ # Use small script executed by bash to have a normal shell environment.
+ rabbitmq-entrypoint = writeShellApplication {
+ name = "rabbitmq-init";
+ text = ''
+ source ${../scripts/source_development_defaults.sh}
+ # RabbitMQ is mostly configured through environment variables
+ # located in scripts/source_development_defaults.sh
+ mkdir -p "$RABBITMQ_LOG_BASE"
+
+ echo "View RabbitMQ logs: tail -f $RABBITMQ_LOGS" >&2
+ echo "Kill RabbitMQ server: pkill rabbitmq-server beam.smp" >&2
+
+ # 'exec' allows for us to replace bash process with RabbitMQ
+ exec "${rabbitmq-server}/bin/rabbitmq-server" \
+ > "$RABBITMQ_LOG_BASE/startup.log"
+ '';
+ };
+
+# writeShellApplication is a "writer helper" which
+# will create a shellchecked executable shell script located in $out/bin/<name>
+# This shell script will be used to allow for impure+stateful actions
+in writeShellApplication {
+ name = "rabbitmq-up";
+ text = ''
+ RABBITMQ_HOME=''${XDG_DATA_HOME:-$HOME/.local/share}/RabbitMQ
+ RABBITMQ_PIDFILE=''${RABBITMQ_HOME}/rabbitmq.pid
+
+ "${../scripts/start_comm_daemon.sh}" \
+ rabbitmq-server \
+ RabbitMQ \
+ "${rabbitmq-entrypoint}/bin/rabbitmq-init" \
+ "$RABBITMQ_PIDFILE"
+
+ # Explicitly exit this script so the parent shell can determine
+ # when it's safe to return control of terminal to user
+ exit 0
+ '';
+}
diff --git a/scripts/source_development_defaults.sh b/scripts/source_development_defaults.sh
--- a/scripts/source_development_defaults.sh
+++ b/scripts/source_development_defaults.sh
@@ -13,3 +13,13 @@
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/tools
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin:$ANDROID_SDK_ROOT/platform-tools
+
+# User defaults of
+# https://www.rabbitmq.com/configure.html#supported-environment-variables
+export RABBITMQ_NODENAME=comm
+export RABBITMQ_HOME=${XDG_DATA_HOME:-$HOME/.local/share}/RabbitMQ
+export RABBITMQ_MNESIA_BASE=${RABBITMQ_HOME}/mnesia
+export RABBITMQ_LOG_BASE=${RABBITMQ_HOME}/logs
+export RABBITMQ_LOGS=${RABBITMQ_LOG_BASE}/comm.log
+export RABBITMQ_PLUGINS_EXPAND_DIR=${RABBITMQ_HOME}/plugins_expand
+export RABBITMQ_PID_FILE=${RABBITMQ_HOME}/rabbitmq.pid
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 4:59 AM (18 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2693596
Default Alt Text
D4948.id18412.diff (3 KB)
Attached To
Mode
D4948: [Nix] Add rabbitmq-up command
Attached
Detach File
Event Timeline
Log In to Comment