reciproka-ops/profiles/voc-web.nix
2021-11-26 08:41:01 +10:00

48 lines
1.1 KiB
Nix

# NixOps configuration for deploying the Voices of Capricornia website
{ config, pkgs, ... }:
let
sources = import ../nix/sources.nix;
voc-web = import sources.voc-web { };
webdomain = "voicesofcapricornia.org";
in {
environment.sessionVariables = {
LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
};
services.nginx = {
enable = true; # Enable Nginx
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts = {
"${webdomain}" = { # website hostname
enableACME = true; # Use ACME certs
forceSSL = true; # Force SSL
root = "${voc-web}"; # Wesbite root
};
"www.${webdomain}" = { # Respect our elders :-)
locations."/".extraConfig =
"return 301 $scheme://${webdomain}$request_uri;";
};
};
};
security.acme = {
acceptTerms = true;
certs = {
"${webdomain}" = {
email = "admin@${webdomain}";
#group = "matrix-synapse";
};
};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
}