katja's git: nixfiles

ctucx' nixfiles

commit ba250a8acd07417b51f8742048302debad7d7d20
parent 2a76b5ebe1fb3d32fe4bffd19344566122531d1c
Author: Katja (ctucx) <git@ctu.cx>
Date: Sat, 26 Apr 2025 20:04:38 +0200

configurations/nixos/websites: ctu.cx -> katja.wtf
5 files changed, 33 insertions(+), 25 deletions(-)
diff --git a/configurations/nixos/services/gotosocial.nix b/configurations/nixos/services/gotosocial.nix
@@ -96,9 +96,9 @@
       useACMEHost = lib.mkDefault "${config.networking.fqdn}";
       forceSSL    = lib.mkDefault true;
       kTLS        = lib.mkDefault true;
-      locations."/.well-known/host-meta".extraConfig = "return 301 https://${config.services.gotosocial.settings.host}$request_uri;";
-      locations."/.well-known/webfinger".extraConfig = "return 301 https://${config.services.gotosocial.settings.host}$request_uri;";
-      locations."/.well-known/nodeinfo".extraConfig  = "return 301 https://${config.services.gotosocial.settings.host}$request_uri;";
+      locations."= /.well-known/host-meta".extraConfig = "return 301 https://${config.services.gotosocial.settings.host}$request_uri;";
+      locations."= /.well-known/webfinger".extraConfig = "return 301 https://${config.services.gotosocial.settings.host}$request_uri;";
+      locations."= /.well-known/nodeinfo".extraConfig  = "return 301 https://${config.services.gotosocial.settings.host}$request_uri;";
     };
   } else {});
 
diff --git a/configurations/nixos/websites/ctu.cx.nix b/configurations/nixos/websites/ctu.cx.nix
@@ -1,19 +0,0 @@
-{ dnsNix, node, pkgs, lib, config, ...}:
-
-{
-
-  dns.zones."ctu.cx"    = (dnsNix.combinators.host node.ip4Address node.ip6Address);
-  dns.zones."katja.wtf" = (dnsNix.combinators.host node.ip4Address node.ip6Address);
-
-  services.nginx = {
-    enable = true;
-    virtualHosts."ctu.cx" = {
-      useACMEHost = "${config.networking.fqdn}";
-      forceSSL      = true;
-      serverAliases = [ "katja.wtf" ];
-      kTLS          = true;
-      root          = pkgs.ctucx-website;
-    };
-  };
-
-}
diff --git a/configurations/nixos/websites/katja.wtf.nix b/configurations/nixos/websites/katja.wtf.nix
@@ -0,0 +1,27 @@
+{ dnsNix, node, pkgs, lib, config, ...}:
+
+{
+
+  dns.zones."ctu.cx"    = dnsNix.combinators.host node.ip4Address node.ip6Address;
+  dns.zones."katja.wtf" = dnsNix.combinators.host node.ip4Address node.ip6Address;
+
+  services.nginx = {
+    enable = true;
+    virtualHosts = {
+      "katja.wtf" = {
+        useACMEHost = "${config.networking.fqdn}";
+        forceSSL      = true;
+        kTLS          = true;
+        root          = pkgs.ctucx-website;
+      };
+
+      "ctu.cx" = {
+        useACMEHost = "${config.networking.fqdn}";
+        forceSSL    = true;
+        kTLS        = true;
+        locations."/".return = "307 https://katja.wtf$request_uri";
+      };
+    };
+  };
+
+}
diff --git a/configurations/nixos/websites/matrix.ctu.cx.nix b/configurations/nixos/websites/matrix.ctu.cx.nix
@@ -66,11 +66,11 @@
         forceSSL    = true;
         kTLS        = true;
         locations   = {
-          "/.well-known/matrix/server".extraConfig = ''
+          "= /.well-known/matrix/server".extraConfig = ''
             add_header Content-Type application/json;
             return 200 '${builtins.toJSON matrixServerConfig}';
           '';
-          "/.well-known/matrix/client".extraConfig = ''
+          "= /.well-known/matrix/client".extraConfig = ''
             add_header Content-Type application/json;
             return 200 '${builtins.toJSON matrixClientConfig}';
           '';
diff --git a/nodes/rabbit/default.nix b/nodes/rabbit/default.nix
@@ -29,7 +29,7 @@
       ctucxConfig.websites."grafana.infra.katja.wtf"
 
       # website / webservices
-      ctucxConfig.websites."ctu.cx"
+      ctucxConfig.websites."katja.wtf"
       ctucxConfig.websites."oeffi.katja.wtf"
       ctucxConfig.websites."things.katja.wtf"
       ctucxConfig.websites."bikemap.katja.wtf" # depends on git