nix/container/Rabbitmq.nix

49 lines
1 KiB
Nix
Raw Normal View History

2024-06-25 04:04:39 +03:00
{ container, pkgs, util, lib, config, ... }: with lib; let
cfg = config.container.module.rabbitmq;
2024-06-09 23:35:53 +03:00
in {
2024-06-25 04:04:39 +03:00
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-09 23:35:53 +03:00
};
};
2024-06-25 04:04:39 +03:00
};
config = mkIf cfg.enable {
systemd.tmpfiles.rules = container.mkContainerDir cfg [
"data"
];
containers.rabbitmq = container.mkContainer cfg {
bindMounts = {
"/var/lib/rabbitmq" = {
hostPath = "${cfg.storage}/data";
isReadOnly = false;
};
};
2024-06-09 23:35:53 +03:00
2024-06-25 04:04:39 +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-20 17:24:03 +03:00
};
2024-06-09 23:35:53 +03:00
};
};
};
}