{ flakes, pkgs, ... }:
let
  totpal = flakes.totpal.packages.${pkgs.system}.default;
in
{
  services.nginx = {
    virtualHosts."totpal.donsz.nl" = {
      forceSSL = true;
      http2 = true;
      enableACME = true;

      locations."/" = {
        proxyPass = "http://[::1]:2442";
      };
    };
  };

  systemd.services.totpal = {
    description = "totpal";
    serviceConfig = {
      Type = "simple";
      ExecStart = "${totpal}/bin/totpal";
    };
  };
}
