nixos-conf/modules/services/utils/nginx-https-server.nix

36 lines
752 B
Nix

{ config, lib, ... }:
let
cfg = config.custom.nginxHttpsServer;
in
{
options = {
custom.nginxHttpsServer.enable = lib.mkOption {
type = lib.types.bool;
default = false;
};
services.nginx.virtualHosts = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule {
config = lib.mkIf cfg.enable (
lib.mkDefault {
forceSSL = true;
kTLS = true;
}
);
}
);
};
};
config = lib.mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [ 443 ];
services.nginx = {
enable = true;
recommendedOptimisation = true;
recommendedTlsSettings = true;
recommendedProxySettings = true;
};
};
}