From f6c673300e8ee5130034f5fdae029ff7ed57ba94 Mon Sep 17 00:00:00 2001 From: Fiscal Velvet Poet Date: Thu, 18 Nov 2021 22:10:33 +1000 Subject: [PATCH] resrok-web: initial deployment --- hosts/toscano.nix | 1 + nix/sources.json | 6 +++--- profiles/resrok-web.nix | 46 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 profiles/resrok-web.nix diff --git a/hosts/toscano.nix b/hosts/toscano.nix index 049686e..d54f963 100644 --- a/hosts/toscano.nix +++ b/hosts/toscano.nix @@ -11,6 +11,7 @@ ../profiles/gitea.nix ../profiles/hakyll-skeleton.nix ../profiles/jfdic-web.nix + ../profiles/resrok-web.nix ../secrets/gitea.nix ]; diff --git a/nix/sources.json b/nix/sources.json index 0cad71b..cc575d7 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -49,9 +49,9 @@ "url_template": "https://github.com///archive/.tar.gz" }, "resrok-web": { - "sha256": "11gfpnmpd8zqcqzydl02m9isz4vh9x1z1bgpi3fhbbxi1pjzdf25", + "sha256": "0xcsjz0yyiq1qrpn632gmr89cwik9j1i9gw76vn063x4x5a759qh", "type": "tarball", - "url": "https://source.jfdic.org/resrok/resrok-web/archive/321ac6c77d870a54fcf901423bdc2280bbcac755.tar.gz", - "url_template": "https://source.jfdic.org/resrok/resrok-web/archive/321ac6c77d870a54fcf901423bdc2280bbcac755.tar.gz" + "url": "https://source.jfdic.org/resrok/resrok-web/archive/9e2c51f9fbc61852d16fc8abe0878e49af0dd808.tar.gz", + "url_template": "https://source.jfdic.org/resrok/resrok-web/archive/9e2c51f9fbc61852d16fc8abe0878e49af0dd808.tar.gz" } } diff --git a/profiles/resrok-web.nix b/profiles/resrok-web.nix new file mode 100644 index 0000000..df91b67 --- /dev/null +++ b/profiles/resrok-web.nix @@ -0,0 +1,46 @@ +# 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 ]; + +}