From 9f3196cd1f5c9d35bf4f93d848415321f5df2ec3 Mon Sep 17 00:00:00 2001 From: Mats Rauhala Date: Mon, 16 May 2022 20:50:26 +0300 Subject: [PATCH] Script for setting up rabbitmq locally --- rabbitmq.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rabbitmq.nix b/rabbitmq.nix index ca5eee9..9039bd9 100644 --- a/rabbitmq.nix +++ b/rabbitmq.nix @@ -1,11 +1,25 @@ { lib, config, pkgs, ... }: +let + cookie = "dontusethisinprod"; + setup = pkgs.writeScriptBin "setup-rabbitmq.sh" '' + rabbitmqctl --erlang-cookie "${cookie}" add_user admin_user password + rabbitmqctl --erlang-cookie "${cookie}" set_user_tags admin_user administrator + rabbitmqctl --erlang-cookie "${cookie}" set_permissions -p / admin_user ".*" ".*" ".*" + + rabbitmqctl --erlang-cookie "${cookie}" add_user reddit_user password + rabbitmqctl --erlang-cookie "${cookie}" set_permissions -p / reddit_user ".*" ".*" ".*" + ''; +in { services.rabbitmq = { enable = true; listenAddress = "0.0.0.0"; managementPlugin.enable = true; + cookie = "dontusethisinprod"; }; networking.firewall.allowedTCPPorts = [ 5672 15672 ]; + + environment.systemPackages = [ setup ]; }