From 04f102d7c42c95954a0c8dffcfd94f67576e5132 Mon Sep 17 00:00:00 2001 From: Fiscal Velvet Poet Date: Tue, 16 Nov 2021 20:13:12 +1000 Subject: [PATCH] jfdic-web: deployed --- hosts/toscano.nix | 3 +++ nix/sources.json | 6 +++--- profiles/jfdic-web.nix | 47 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 profiles/jfdic-web.nix diff --git a/hosts/toscano.nix b/hosts/toscano.nix index a350169..5d68e0d 100644 --- a/hosts/toscano.nix +++ b/hosts/toscano.nix @@ -1,4 +1,6 @@ # NixOps configuration for toscano +# +# https://en.wikipedia.org/wiki/Joseph_Toscano { config, pkgs, lib, ... }: @@ -8,6 +10,7 @@ [ ../networks/linode.nix ../profiles/gitea.nix + ../profiles/jfdic-web.nix ../secrets/gitea.nix ]; diff --git a/nix/sources.json b/nix/sources.json index c6bb3f9..fad915b 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -1,9 +1,9 @@ { "jfdic-web": { - "sha256": "1fj352d70xfl9vdi7xzz6hnzjpqzffc7fj5wnf7pr879wsdp9fbh", + "sha256": "0qq4ww89isivyllqs15cg21f4g9fhy3zpiywxash2hk5dg6klx50", "type": "tarball", - "url": "https://source.jfdic.org/JFDIC/jfdic-web/archive/456c35c6113d7f6473fc01318aa47e0124f08f80.tar.gz", - "url_template": "https://source.jfdic.org/JFDIC/jfdic-web/archive/456c35c6113d7f6473fc01318aa47e0124f08f80.tar.gz" + "url": "https://source.jfdic.org/JFDIC/jfdic-web/archive/60bdb93b5c98121252d1f6174e11baae17a04b31.tar.gz", + "url_template": "https://source.jfdic.org/JFDIC/jfdic-web/archive/60bdb93b5c98121252d1f6174e11baae17a04b31.tar.gz" }, "niv": { "branch": "master", diff --git a/profiles/jfdic-web.nix b/profiles/jfdic-web.nix new file mode 100644 index 0000000..897534e --- /dev/null +++ b/profiles/jfdic-web.nix @@ -0,0 +1,47 @@ +# NixOps configuration for deploying the JFDIC website + +{ config, pkgs, ... }: + +let + sources = import ../nix/sources.nix; + jfdic-web = import sources.jfdic-web { }; + webdomain = "jfdic.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 = "${jfdic-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 ]; + +}