Add www. alias to every host

Currently some services on Clicks do not have www. aliases. This becomes a
problem when other sites link do them due to a www. page displaying the default
"welcome to nginx" page. This commit fixes that.

Potential downsides notwithstanding...:
- Pages that do already have www. aliases will now have www.www. aliases
- All certificates will need to be regenerated
- Sites not setup through clicks helpers (nextcloud, privatebin) will not be
  affected
...we have decided this is the best solution and would like to proceed

Change-Id: I2e0a505df9c150376d90b0957c6fdf31faee8ac4
Reviewed-on: https://git.clicks.codes/c/Clicks/NixHelpers/+/161
Tested-by: Ash Franks <pineafan@clicks.codes>
Reviewed-by: Ash Franks <pineafan@clicks.codes>
diff --git a/nginx.nix b/nginx.nix
index 47f05f8..3ad045e 100644
--- a/nginx.nix
+++ b/nginx.nix
@@ -95,7 +95,8 @@
         _merge service.service (lib.recursiveUpdate currentConfig {
           name = service.host;
           value = {
-            serverAliases = service.extraHosts;
+            serverAliases = service.extraHosts ++ [ "www.${service.host}" ]
+              ++ (map (host: "www.${host}") service.extraHosts);
 
             enableACME = true;
             forceSSL = service.secure;
@@ -106,7 +107,10 @@
       else if service.type == "reverseproxy" then
         (lib.recursiveUpdate currentConfig {
           value.locations.${currentPath} = {
-            proxyPass = if currentPath == "/" then "http://${service.to}" else "http://${service.to}/";
+            proxyPass = if currentPath == "/" then
+              "http://${service.to}"
+            else
+              "http://${service.to}/";
             proxyWebsockets = true;
             recommendedProxySettings = true;
           };