From fecf8d6b411f244ed78936a77aad3a9649174b2b Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Fri, 29 Apr 2022 08:47:52 -0500 Subject: [PATCH] Automatic serverAliases --- hosts/2maccabees/dnsmasq.nix | 2 +- modules/proxy.nix | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hosts/2maccabees/dnsmasq.nix b/hosts/2maccabees/dnsmasq.nix index 000d958..4c84e8b 100644 --- a/hosts/2maccabees/dnsmasq.nix +++ b/hosts/2maccabees/dnsmasq.nix @@ -4,7 +4,7 @@ let extraHosts = builtins.concatStringsSep "\n" [ "10.42.0.1 switch" "10.42.1.1 router" - "10.42.1.2 dns smart" + "10.42.1.2 dns dns.thehellings.lan smart smart.thehellings.lan" "100.99.244.92 dns.me.ts" "10.42.1.3 printer" "10.42.1.4 chronicles nas" diff --git a/modules/proxy.nix b/modules/proxy.nix index c13247f..7e0768f 100644 --- a/modules/proxy.nix +++ b/modules/proxy.nix @@ -3,6 +3,8 @@ let cfg = config.greg.proxies; + alias = name: with builtins; head (split "\\." name); + makeHost = name: dest: { forceSSL = dest.ssl; enableACME = dest.ssl; @@ -14,6 +16,7 @@ proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; ''; }; + serverAliases = [ "${alias name}" ]; }; in with lib; {