ctucx.git: nixfiles

ctucx' nixfiles

commit bc01414d34610802866f70c5652dc51c2fba4336
parent b5ef5dde6d079e6f980026925f7f4ecad2820407
Author: Katja (ctucx) <git@ctu.cx>
Date: Tue, 3 Dec 2024 09:40:53 +0100

machines/trabbi/websites: move `ctu.cx` to `hector`
7 files changed, 54 insertions(+), 56 deletions(-)
diff --git a/machines/hector/fedi/gotosocial.nix b/machines/hector/fedi/gotosocial.nix
@@ -77,14 +77,14 @@ in {
     proxy_cache_path /var/cache/nginx keys_zone=gotosocial_ap_public_responses:10m inactive=1w;
   '';
 
-  # services.nginx.virtualHosts."ctu.cx" = {
-  #   enableACME = true;
-  #   forceSSL   = true;
-  #   kTLS       = true;
-  #   locations."/.well-known/host-meta".extraConfig = "return 301 https://fedi.ctu.cx$request_uri;";
-  #   locations."/.well-known/webfinger".extraConfig = "return 301 https://fedi.ctu.cx$request_uri;";
-  #   locations."/.well-known/nodeinfo".extraConfig  = "return 301 https://fedi.ctu.cx$request_uri;";
-  # };
+  services.nginx.virtualHosts."ctu.cx" = {
+    enableACME = true;
+    forceSSL   = true;
+    kTLS       = true;
+    locations."/.well-known/host-meta".extraConfig = "return 301 https://fedi.ctu.cx$request_uri;";
+    locations."/.well-known/webfinger".extraConfig = "return 301 https://fedi.ctu.cx$request_uri;";
+    locations."/.well-known/nodeinfo".extraConfig  = "return 301 https://fedi.ctu.cx$request_uri;";
+  };
 
   services.nginx.virtualHosts."fedi.ctu.cx" = {
     enableACME = true;
diff --git a/machines/hector/websites/ctu.cx.nix b/machines/hector/websites/ctu.cx.nix
@@ -0,0 +1,32 @@
+{ pkgs, lib, config, ...}:
+
+{
+
+  dns.zones."ctu.cx" =  (pkgs.dns.lib.combinators.host config.networking.primaryIP4 config.networking.primaryIP);
+
+  services.nginx = {
+    enable = true;
+    virtualHosts."ctu.cx" = {
+      enableACME = true;
+      forceSSL   = true;
+      kTLS       = true;
+      root       = pkgs.ctucx-website;
+      locations  = let
+        matrixServerConfig = { "m.server" = "matrix.ctu.cx:443"; };
+        matrixClientConfig = { "m.homeserver" = { "base_url" = "https://matrix.ctu.cx"; }; "org.matrix.msc3575.proxy" = { "url" = "https://matrix.ctu.cx"; }; };
+      in {
+        "/netzabdeckung.html".return = "307 https://wifionic.de/";
+        "/bikemap".return = "307 https://bikemap.ctu.cx/";
+        "/.well-known/matrix/server".extraConfig = ''
+          add_header Content-Type application/json;
+          return 200 '${builtins.toJSON matrixServerConfig}';
+        '';
+        "/.well-known/matrix/client".extraConfig = ''
+          add_header Content-Type application/json;
+          return 200 '${builtins.toJSON matrixClientConfig}';
+        '';
+      };
+    };
+  };
+
+}
diff --git a/machines/hector/websites/default.nix b/machines/hector/websites/default.nix
@@ -3,6 +3,7 @@
 {
 
   imports = [
+    ./ctu.cx.nix
     ./things.ctu.cx.nix
     ./bikemap.ctu.cx.nix
   ];
diff --git a/machines/trabbi/default.nix b/machines/trabbi/default.nix
@@ -12,8 +12,6 @@
     ./matrix
     ./mail
 
-
-    ./websites
     ./travelynx2fedi.nix
   ];
 
diff --git a/machines/trabbi/matrix/synapse.nix b/machines/trabbi/matrix/synapse.nix
@@ -67,19 +67,19 @@
         matrixServerConfig = { "m.server" = "matrix.ctu.cx:443"; };
         matrixClientConfig = { "m.homeserver" = { "base_url" = "https://matrix.ctu.cx"; }; "org.matrix.msc3575.proxy" = { "url" = "https://matrix.ctu.cx"; }; };
       in {
-        "ctu.cx" = {
-          enableACME = true;
-          forceSSL   = true;
-          kTLS       = true;
-          locations."/.well-known/matrix/server".extraConfig = ''
-            add_header Content-Type application/json;
-            return 200 '${builtins.toJSON matrixServerConfig}';
-          '';
-          locations."/.well-known/matrix/client".extraConfig = ''
-            add_header Content-Type application/json;
-            return 200 '${builtins.toJSON matrixClientConfig}';
-          '';
-        };
+        # "ctu.cx" = {
+        #   enableACME = true;
+        #   forceSSL   = true;
+        #   kTLS       = true;
+        #   locations."/.well-known/matrix/server".extraConfig = ''
+        #     add_header Content-Type application/json;
+        #     return 200 '${builtins.toJSON matrixServerConfig}';
+        #   '';
+        #   locations."/.well-known/matrix/client".extraConfig = ''
+        #     add_header Content-Type application/json;
+        #     return 200 '${builtins.toJSON matrixClientConfig}';
+        #   '';
+        # };
 
         "matrix.ctu.cx" = {
           enableACME = true;
diff --git a/machines/trabbi/websites/ctu.cx.nix b/machines/trabbi/websites/ctu.cx.nix
@@ -1,24 +0,0 @@
-{ pkgs, lib, config, ...}:
-
-{
-
-  dns.zones."ctu.cx" =  (pkgs.dns.lib.combinators.host config.networking.primaryIP4 config.networking.primaryIP);
-
-  services.nginx = {
-    enable = true;
-    virtualHosts."ctu.cx" = {
-      enableACME = true;
-      forceSSL   = true;
-      kTLS       = true;
-      root       = pkgs.ctucx-website;
-      locations  = {
-        "/netzabdeckung.html".return = "307 https://wifionic.de/";
-        "/bikemap".return = "307 https://bikemap.ctu.cx/";
-        "/.well-known/host-meta".extraConfig = "return 301 https://fedi.ctu.cx$request_uri;";
-        "/.well-known/webfinger".extraConfig = "return 301 https://fedi.ctu.cx$request_uri;";
-        "/.well-known/nodeinfo".extraConfig  = "return 301 https://fedi.ctu.cx$request_uri;";
-       };
-    };
-  };
-
-}
diff --git a/machines/trabbi/websites/default.nix b/machines/trabbi/websites/default.nix
@@ -1,9 +0,0 @@
-{ ... }:
-
-{
-
-  imports = [
-    ./ctu.cx.nix
-  ];
-
-}