{ config, lib, ... }:
{
  imports = [ ./nginx ];

  config = lib.mkIf config.services.vaultwarden.enable {
    services.vaultwarden.config = {
      domain = "https://pass.nixfox.ca";
      signupsAllowed = false;
      rocketAddress = "127.0.0.1";
      rocketPort = 8222;

      # Smtp email
      smtpHost = "mx.nixfox.ca";
      smtpFrom = "noreply@nixfox.ca";
      smtpFromName = "Vaultwarden";
      smtpUsername = "noreply@nixfox.ca";
      smtpPassword = config.secrets.mailPass.nixfoxNoReply;
      smtpSecurity = "starttls";
      smtpPort = 587;
      smtpTimeout = 15;
    };

    environment.persistence."/persist".directories = [ "/var/lib/vaultwarden" ];
  };
}
