summary refs log tree commit diff
path: root/hosts/vps
diff options
context:
space:
mode:
authortzlil <tzlils@protonmail.com>2023-02-16 16:40:26 +0200
committertzlil <tzlils@protonmail.com>2023-02-16 16:40:26 +0200
commitd4896b353eed0ab37cf8a2591fe1f5369c37883f (patch)
tree267fcc685ce9efa2db60e51c772ef58ccfe6d330 /hosts/vps
parent566dc1e8f6e619f590f017a810a8a55d9a90a25c (diff)
stuff
Diffstat (limited to 'hosts/vps')
-rw-r--r--hosts/vps/cfg.nix2
-rw-r--r--hosts/vps/git.nix40
-rw-r--r--hosts/vps/matrix.nix23
-rw-r--r--hosts/vps/website.nix14
4 files changed, 73 insertions, 6 deletions
diff --git a/hosts/vps/cfg.nix b/hosts/vps/cfg.nix
index 3e220c3..a8159ea 100644
--- a/hosts/vps/cfg.nix
+++ b/hosts/vps/cfg.nix
@@ -5,6 +5,8 @@
     ../../profiles/ssh.nix
     ../../mixins/tailscale.nix
     ../../mixins/cli.nix
+    ./website.nix
+    ./git.nix
   ];
 
   config = {
diff --git a/hosts/vps/git.nix b/hosts/vps/git.nix
new file mode 100644
index 0000000..3ad26c0
--- /dev/null
+++ b/hosts/vps/git.nix
@@ -0,0 +1,40 @@
+{ pkgs, config, ... }:
+
+{
+  config = {
+    users.users.git = {
+      isSystemUser = true;
+      description = "git";
+      home = "/home/git";
+      shell = "${pkgs.git}/bin/git-shell";
+      openssh.authorizedKeys.keys = [
+        "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMDyzrs9sbstv3KFK5FV8qYlSknnEy8Cn+qch4dJLmHA"
+      ];
+    };
+    services = {
+      fcgiwrap.enable = true;
+      caddy = {
+        virtualHosts."http://localhost".extraConfig = ''
+          reverse_proxy localhost:5678 { 
+            transport fastcgi {
+              env SCRIPT_FILENAME ${pkgs.cgit}/cgit/cgit.cgi
+              env CGIT_CONFIG ${pkgs.writeText "cgitrc" (lib.generators.toKeyValue { } {
+                clone-url = (lib.concatStringsSep " " [
+                  "http://$HTTP_HOST$SCRIPT_NAME/$CGIT_REPO_URL"
+                  "ssh://git@git.example.com:$CGIT_REPO_URL"
+                ]);
+                enable-log-filecount = 1;
+                enable-log-linecount = 1;
+                enable-git-config = 1;
+                root-title = "git.example.com";
+                root-desc = "Tzlil's Git Repositories";
+                scan-path = "/home/git";
+              })}
+            } 
+          }
+        '';
+      }
+    };
+    environment.persistence."/nix/persist".directories = [ "/home/git" ];
+  };
+}
\ No newline at end of file
diff --git a/hosts/vps/matrix.nix b/hosts/vps/matrix.nix
new file mode 100644
index 0000000..cb13326
--- /dev/null
+++ b/hosts/vps/matrix.nix
@@ -0,0 +1,23 @@
+{ pkgs, config, ... }:
+
+{
+  config = {
+    services.matrix-synapse = {
+        enable = true;
+        settings.server_name = config.networking.domain;
+        settings.listeners = [
+          { port = 8008;
+            bind_addresses = [ "::1" ];
+            type = "http";
+            tls = false;
+            x_forwarded = true;
+            resources = [ {
+              names = [ "client" "federation" ];
+              compress = true;
+            } ];
+          }
+        ];
+    };
+    networking.firewall.allowedTCPPorts = [80 443];
+  };
+}
\ No newline at end of file
diff --git a/hosts/vps/website.nix b/hosts/vps/website.nix
index 156e5da..9dc9fc7 100644
--- a/hosts/vps/website.nix
+++ b/hosts/vps/website.nix
@@ -4,12 +4,14 @@
   config = {
     services.caddy = {
       enable = true;
-      virtualHosts."https://tzlil.club".extraConfig = ''
-        try_files ${pkgs.writeText "index.html" ''
-          hello world
-        ''} /
-      '';
+      # virtualHosts = {
+      #   "http://localhost".extraConfig = ''
+      #     try_files ${pkgs.writeText "index.html" ''
+      #       hello world
+      #     ''} /
+      #   '';
+      # };
     };
-    networking.firewall.allowedTCPPorts = [443];
+    networking.firewall.allowedTCPPorts = [80 443];
   };
 }
\ No newline at end of file