mailsystem: nginx: Replace incorrect usage of lib.mkIf with lib.optionalAttrs
Evaluation of lib.mkIf and lib.optionalAttrs is slightly different. In this specific case, the usage of lib.mkIf resulted in the defined virtualHost never actually being applied due to an earlier error in the evaluation order.
This commit is contained in:
parent
e6e91b775a
commit
53e2b9f621
1 changed files with 9 additions and 6 deletions
|
|
@ -11,12 +11,15 @@ in {
|
||||||
lib.mkIf cfg.enable {
|
lib.mkIf cfg.enable {
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
virtualHosts."${cfg.fqdn}" = {
|
virtualHosts."${cfg.fqdn}" =
|
||||||
forceSSL = true;
|
{
|
||||||
enableACME = cfg.certificateScheme == "acme";
|
forceSSL = true;
|
||||||
sslCertificate = lib.mkIf (cfg.certificateScheme == "selfsigned") sslCertPath;
|
enableACME = cfg.certificateScheme == "acme";
|
||||||
sslCertificateKey = lib.mkIf (cfg.certificateScheme == "selfsigned") sslKeyPath;
|
}
|
||||||
};
|
// lib.optionalAttrs (cfg.certificateScheme == "selfsigned") {
|
||||||
|
sslCertificate = sslCertPath;
|
||||||
|
sslCertificateKey = sslKeyPath;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [80 443];
|
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [80 443];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue