diff options
Diffstat (limited to 'os/srv/nginx.nix')
| -rw-r--r-- | os/srv/nginx.nix | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/os/srv/nginx.nix b/os/srv/nginx.nix new file mode 100644 index 0000000..b0c01a7 --- /dev/null +++ b/os/srv/nginx.nix @@ -0,0 +1,36 @@ +{ config, lib, ... }: + +let + cfg = config.os.srv.nginx; +in +{ + options.os.srv.nginx = { + enable = lib.mkEnableOption "the NGINX reverse proxy service"; + + openFirewall = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Whether to open ports 80 and 443 in the firewall."; + }; + }; + + config = lib.mkIf cfg.enable { + services.nginx = { + enable = true; + + recommendedProxySettings = true; + recommendedTlsSettings = true; + recommendedOptimisation = true; + recommendedGzipSettings = true; + }; + + networking.firewall.allowedTCPPorts = lib.mkOptional cfg.openFirewall [ + 80 + 443 + ]; + + systemd.tmpfiles.rules = [ + "d /var/log/nginx 0750 nginx adm -" + ]; + }; +} |
