infra/services/ofborg/default.nix

38 lines
1 KiB
Nix
Raw Normal View History

{ config, lib, ... }:
let
cfg = config.bagel.services.ofborg;
amqpHost = "amqp.forkos.org";
amqpPort = 5671;
in {
options.bagel.services.ofborg = with lib; {
enable = mkEnableOption "ofborg coordinator";
};
config = lib.mkIf cfg.enable {
services.rabbitmq = {
enable = true;
configItems = {
"listeners.tcp" = "none";
"listeners.ssl.default" = builtins.toString amqpPort;
"ssl_options.certfile" = "${config.security.acme.certs.${amqpHost}.directory}/cert.pem";
"ssl_options.keyfile" = "${config.security.acme.certs.${amqpHost}.directory}/key.pem";
};
};
security.acme.certs.${amqpHost} = {
webroot = "/var/lib/acme/.challenges";
group = "rabbitmq";
};
2024-11-17 11:48:08 +00:00
services.nginx.enable = true;
services.nginx.virtualHosts.${amqpHost}.locations."/.well-known/acme-challenge".root =
"/var/lib/acme/.challenges";
systemd.services.rabbitmq.requires = ["acme-finished-${amqpHost}.target"];
2024-11-17 11:48:08 +00:00
networking.firewall.allowedTCPPorts = [ 80 443 amqpPort ];
};
}