diff options
Diffstat (limited to 'os/fscusat/modules/www.nix')
-rw-r--r-- | os/fscusat/modules/www.nix | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/os/fscusat/modules/www.nix b/os/fscusat/modules/www.nix new file mode 100644 index 0000000..24398da --- /dev/null +++ b/os/fscusat/modules/www.nix @@ -0,0 +1,36 @@ +{ config, ... }: + +let + domain = "foss.fscusat.ac.in"; +in +{ + networking.firewall.allowedTCPPorts = [ 80 443 ]; + + sops.secrets = let + opts = { + owner = config.services.nginx.user; + group = config.services.nginx.group; + }; + in{ + "cusat.ac.in/key" = opts; + "cusat.ac.in/crt" = opts; + }; + + services.nginx = { + enable = true; + recommendedTlsSettings = true; + recommendedZstdSettings = true; + recommendedOptimisation = true; + recommendedGzipSettings = true; + recommendedProxySettings = true; + recommendedBrotliSettings = true; + + virtualHosts.${domain} = { + forceSSL = true; + sslCertificateKey = config.sops.secrets."cusat.ac.in/key".path; + sslCertificate = config.sops.secrets."cusat.ac.in/crt".path; + + locations."/".extraConfig = "return 307 $scheme://$host/mirror/;"; + }; + }; +} |