mio-ops/profiles/craige4rocky.nix

52 lines
1.3 KiB
Nix
Raw Normal View History

2020-09-17 01:12:02 +00:00
# NixOps configuration for deploying the craige4rocky website
2021-11-16 04:57:23 +00:00
{ config, pkgs, ... }:
2020-09-17 01:12:02 +00:00
let
craige4rocky = import (pkgs.fetchgit {
2021-11-16 04:57:23 +00:00
name = "craige4rocky-src";
url = "https://source.mcwhirter.io/craige/craige4rocky.git";
2020-09-17 01:12:02 +00:00
branchName = "master";
2021-11-16 04:57:23 +00:00
sha256 = "1cammdgszclrhvp56af3c7vnanyn0gplvkhqi6jkg1ygy01ard4w";
2020-09-17 01:12:02 +00:00
}) { nixpkgs = pkgs; };
webdomain = "craige4rocky.org";
in {
environment.sessionVariables = {
LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
};
services.nginx = {
2021-11-16 04:57:23 +00:00
enable = true; # Enable Nginx
recommendedGzipSettings = true;
recommendedOptimisation = true;
2020-09-17 01:12:02 +00:00
recommendedProxySettings = true;
2021-11-16 04:57:23 +00:00
recommendedTlsSettings = true;
2020-09-17 01:12:02 +00:00
virtualHosts = {
2021-11-16 04:57:23 +00:00
"${webdomain}" = { # website hostname
enableACME = true; # Use ACME certs
forceSSL = true; # Force SSL
root = "${craige4rocky}"; # Wesbite root
2020-09-17 01:12:02 +00:00
};
2021-11-16 04:57:23 +00:00
"www.${webdomain}" = { # Respect our elders :-)
2020-09-17 01:12:02 +00:00
forceSSL = true;
enableACME = true;
2021-11-16 04:57:23 +00:00
locations."/".extraConfig =
"return 301 $scheme://${webdomain}$request_uri;";
2020-09-17 01:12:02 +00:00
};
};
};
security.acme = {
acceptTerms = true;
certs = {
2021-11-16 04:57:23 +00:00
"${webdomain}".email = "admin@${webdomain}";
2020-09-17 01:12:02 +00:00
"www.${webdomain}".email = "admin@${webdomain}";
};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
}