nixos-config/hosts/nuc/modules/nginx/default.nix

37 lines
1,006 B
Nix
Raw Normal View History

2023-08-27 15:48:42 +02:00
{ lib, config, ... }:
2023-01-24 11:58:36 +01:00
{
2023-11-16 01:27:01 +01:00
# set default options for virtualHosts
options = with lib; {
services.nginx.virtualHosts = mkOption {
type = types.attrsOf (types.submodule
({ name, ... }: {
# split up nginx access logs per vhost
2024-03-25 19:06:38 +01:00
enableACME = true;
forceSSL = true;
2023-11-16 01:27:01 +01:00
extraConfig = ''
access_log /var/log/nginx/${name}_access.log;
error_log /var/log/nginx/${name}_error.log;
'';
})
);
};
2023-05-05 23:43:40 +02:00
};
2023-11-16 01:27:01 +01:00
config = {
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.nginx = {
enable = true;
recommendedTlsSettings = true;
recommendedProxySettings = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
# virtualHosts = lib.genAttrs v (name: { extraConfig = " lohustuff goes ith ${name}"; });
};
security.acme = {
acceptTerms = true;
defaults = {
email = "rouven@${config.networking.domain}";
};
2023-01-24 11:58:36 +01:00
};
};
}