Add specific host
Aux would prefer not to have www aliases. Let's add support for skipping
adding them
Change-Id: Ia7df65d7c40edf94aa190b15997a8063fc558d7f
Reviewed-on: https://git.clicks.codes/c/Infra/NixHelpers/+/681
Reviewed-by: Skyler Grey <minion@clicks.codes>
Tested-by: Skyler Grey <minion@clicks.codes>
diff --git a/nginx.nix b/nginx.nix
index bc43ad4..7a79fac 100644
--- a/nginx.nix
+++ b/nginx.nix
@@ -5,6 +5,14 @@
inherit host service;
extraHosts = [ ];
secure = true;
+ specific = false;
+ type = "hosts";
+ };
+ SpecificHost = host: service: {
+ inherit host service;
+ extraHosts = [ ];
+ secure = true;
+ specific = true;
type = "hosts";
};
Hosts = hosts: service: {
@@ -12,12 +20,14 @@
host = builtins.elemAt hosts 0;
extraHosts = builtins.tail hosts;
secure = true;
+ specific = false;
type = "hosts";
};
InsecureHost = host: service: {
inherit host service;
extraHosts = [ ];
secure = false;
+ specific = false;
type = "hosts";
};
InsecureHosts = hosts: service: {
@@ -25,6 +35,7 @@
host = builtins.elemAt hosts 0;
extraHosts = builtins.tail hosts;
secure = false;
+ specific = false;
type = "hosts";
};
ReverseProxy = to: {
@@ -105,9 +116,9 @@
_merge service.service (lib.recursiveUpdate currentConfig {
name = service.host;
value = {
- serverAliases = service.extraHosts ++ [ "www.${service.host}" ]
- ++ (map (host: "www.${host}") service.extraHosts);
-
+ serverAliases = service.extraHosts ++ (if service.specific
+ then []
+ else [ "www.${service.host}" ] ++ (map (host: "www.${host}") service.extraHosts));
enableACME = true;
forceSSL = service.secure;
addSSL = !service.secure;