{ pkgs, ... }:

{
  c3d2.deployment.server = "server10";

  microvm.mem = 3 * 1024;

  networking.hostName = "pretalx";

  services = {
    backup.enable = true;

    nginx = {
      enable = true;
      virtualHosts."talks.datenspuren.de" = {
        default = true;
        forceSSL = true;
        enableACME = true;
        serverAliases = [ "pretalx.c3d2.de" ];
      };
    };

    postgresql = {
      enable = true;
      package = pkgs.postgresql_16;
      upgrade.stopServices = [ "pretalx-web" "pretalx-worker" ];
    };

    pretalx = {
      enable = true;
      gunicorn.extraArgs = [
        "--name=pretalx"
        "--workers=4"
        "--max-requests=1200"
        "--max-requests-jitter=50"
        "--log-level=info"
      ];
      nginx.domain = "talks.datenspuren.de";
      settings.mail = {
        from = "noreply@c3d2.de";
        host = "mail.c3d2.de";
        port = "587";
        tls = true;
      };
    };
  };

  sops = {
    defaultSopsFile = ./secrets.yaml;
  };

  system.stateVersion = "23.11";
}
