2024-10-11 23:27:07 +03:00
|
|
|
{
|
2024-11-04 04:37:29 +03:00
|
|
|
config,
|
|
|
|
container,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
util,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
cfg = config.container.module.rabbitmq;
|
|
|
|
in {
|
|
|
|
options.container.module.rabbitmq = {
|
|
|
|
enable = lib.mkEnableOption "the mqtt server.";
|
|
|
|
address = lib.mkOption {
|
|
|
|
default = "10.1.0.28";
|
|
|
|
type = lib.types.str;
|
|
|
|
};
|
|
|
|
port = lib.mkOption {
|
|
|
|
default = 5672;
|
|
|
|
type = lib.types.int;
|
|
|
|
};
|
|
|
|
storage = lib.mkOption {
|
|
|
|
default = "${config.container.storage}/rabbitmq";
|
|
|
|
type = lib.types.str;
|
|
|
|
};
|
|
|
|
};
|
2024-06-25 04:04:39 +03:00
|
|
|
|
2024-11-04 04:37:29 +03:00
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
systemd.tmpfiles.rules = container.mkContainerDir cfg [
|
|
|
|
"data"
|
|
|
|
];
|
2024-06-25 04:04:39 +03:00
|
|
|
|
2024-11-04 04:37:29 +03:00
|
|
|
containers.rabbitmq = container.mkContainer cfg {
|
|
|
|
bindMounts = {
|
|
|
|
"/var/lib/rabbitmq" = {
|
|
|
|
hostPath = "${cfg.storage}/data";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
};
|
2024-06-09 23:35:53 +03:00
|
|
|
|
2024-11-04 04:37:29 +03:00
|
|
|
config = { ... }: container.mkContainerConfig cfg {
|
|
|
|
services.rabbitmq = {
|
|
|
|
enable = true;
|
|
|
|
dataDir = "/var/lib/rabbitmq";
|
|
|
|
listenAddress = cfg.address;
|
|
|
|
port = cfg.port;
|
|
|
|
configItems = {
|
|
|
|
"loopback_users" = "none";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-06-09 23:35:53 +03:00
|
|
|
}
|