mailsystem: Add nginx configuration to retrieve letsencrypt certificate

This commit is contained in:
Thomas Preisner 2024-11-30 19:37:23 +01:00
parent 77e4cac42d
commit 3943ec3356
2 changed files with 41 additions and 0 deletions

20
mailsystem/nginx.nix Normal file
View file

@ -0,0 +1,20 @@
{
config,
pkgs,
lib,
...
}: let
cfg = config.mailsystem;
in {
config = lib.mkIf cfg.enable {
services.nginx = {
enable = true;
virtualHosts."${cfg.fqdn}" = {
forceSSL = true;
enableACME = true;
};
};
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [80 443];
};
}