From a9f3621fd781e88b8bb914b0daf0b06c147f0cd0 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 12 Jun 2020 03:02:18 +0100 Subject: feat(camden): Move hound to cs.tvl.fyi The old host at cs.tazj.in now redirects there, and I've added a helper function for creating these redirections. Change-Id: I66794d752df46c8e795e47aedfaffd8c27c45627 Reviewed-on: https://cl.tvl.fyi/c/depot/+/89 Reviewed-by: riking Reviewed-by: tazjin --- ops/nixos/camden/default.nix | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'ops/nixos') diff --git a/ops/nixos/camden/default.nix b/ops/nixos/camden/default.nix index df1520a767b2..ea8f0f5ad25b 100644 --- a/ops/nixos/camden/default.nix +++ b/ops/nixos/camden/default.nix @@ -5,6 +5,14 @@ config: let nixpkgs = import depot.third_party.nixpkgsSrc { config.allowUnfree = true; }; + + nginxRedirect = { from, to, acmeHost }: { + serverName = from; + useACMEHost = acmeHost; + forceSSL = true; + + extraConfig = "return 301 https://${to}$request_uri;"; + }; in lib.fix(self: { imports = [ ../modules/depot.nix @@ -222,7 +230,6 @@ in lib.fix(self: { # Local domains (for this machine only) "camden.tazj.in" = null; - "git.camden.tazj.in" = null; }; postRun = "systemctl reload nginx"; }; @@ -392,19 +399,9 @@ in lib.fix(self: { ''; }; - virtualHosts.cgit-old = { - serverName = "git.tazj.in"; - useACMEHost = "tazj.in"; - forceSSL = true; - - extraConfig = '' - return 301 https://code.tvl.fyi$request_uri; - ''; - }; - virtualHosts.hound = { - serverName = "cs.tazj.in"; - useACMEHost = "tazj.in"; + serverName = "cs.tvl.fyi"; + useACMEHost = "tvl.fyi"; forceSSL = true; extraConfig = '' @@ -427,6 +424,18 @@ in lib.fix(self: { } ''; }; + + virtualHosts.cgit-old = nginxRedirect { + from = "git.tazj.in"; + to = "code.tvl.fyi"; + acmeHost = "tazj.in"; + }; + + virtualHosts.cs-old = nginxRedirect { + from = "cs.tazj.in"; + to = "cs.tvl.fyi"; + acmeHost = "tazj.in"; + }; }; # Timer units that can be started with systemd-run to set my alarm. -- cgit 1.4.1