reciproka-ops/profiles/resrok-web.nix

47 lines
1.2 KiB
Nix
Raw Normal View History

2021-11-18 12:10:33 +00:00
# NixOps configuration for deploying the JFDIC website
{ config, pkgs, ...}:
let
sources = import ../nix/sources.nix;
resrok-web = import sources.resrok-web {};
webdomain = "resrok.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 = "${resrok-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 ];
}