nix/container/Rabbitmq.nix

59 lines
1.2 KiB
Nix
Raw Normal View History

{
container,
pkgs,
util,
lib,
config,
...
}:
with lib;
let
cfg = config.container.module.rabbitmq;
in
{
options = {
container.module.rabbitmq = {
enable = mkEnableOption "Mqtt server.";
address = mkOption {
default = "10.1.0.28";
type = types.str;
};
port = mkOption {
default = 5672;
type = types.int;
};
storage = mkOption {
default = "${config.container.storage}/rabbitmq";
type = types.str;
};
};
};
2024-06-25 04:04:39 +03:00
config = mkIf cfg.enable {
2024-10-14 04:51:19 +03:00
systemd.tmpfiles.rules = container.mkContainerDir cfg [ "data" ];
2024-06-25 04:04:39 +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
config =
{ ... }:
container.mkContainerConfig cfg {
services.rabbitmq = {
enable = true;
listenAddress = cfg.address;
port = cfg.port;
dataDir = "/var/lib/rabbitmq";
configItems = {
"loopback_users" = "none";
};
};
};
};
};
2024-06-09 23:35:53 +03:00
}