reddit-pub/rabbitmq.nix

26 lines
784 B
Nix
Raw Normal View History

2021-10-25 19:04:24 +03:00
{ lib, config, pkgs, ... }:
2022-05-16 20:50:26 +03:00
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
2021-10-25 19:04:24 +03:00
{
services.rabbitmq = {
enable = true;
listenAddress = "0.0.0.0";
managementPlugin.enable = true;
2022-05-16 20:50:26 +03:00
cookie = "dontusethisinprod";
2021-10-25 19:04:24 +03:00
};
networking.firewall.allowedTCPPorts = [ 5672 15672 ];
2022-05-16 20:50:26 +03:00
environment.systemPackages = [ setup ];
2021-10-25 19:04:24 +03:00
}