about summary refs log tree commit diff
path: root/ops/nixos/camden
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-02-12T01·09+0000
committerVincent Ambo <tazjin@google.com>2020-02-12T01·09+0000
commit4feb306763d96866de16e336702459aaaec98a3b (patch)
tree4342a798e37e3e83fb5eae3d9ad4a95327399bf3 /ops/nixos/camden
parent7373edf73a15c106d556a39ff710e3349433502a (diff)
feat(ops/nixos/camden): Add nginx vhost for cgit at git.camden r/547
Diffstat (limited to 'ops/nixos/camden')
-rw-r--r--ops/nixos/camden/default.nix21
1 files changed, 21 insertions, 0 deletions
diff --git a/ops/nixos/camden/default.nix b/ops/nixos/camden/default.nix
index e3bf8003ced6..8176df5c646b 100644
--- a/ops/nixos/camden/default.nix
+++ b/ops/nixos/camden/default.nix
@@ -149,6 +149,9 @@ in pkgs.lib.fix(self: {
     user = "nginx";
     group = "nginx";
     webroot = "/var/lib/acme/acme-challenge";
+    extraDomains = {
+      "git.camden.tazj.in" = null;
+    };
     postRun = "systemctl reload nginx";
   };
 
@@ -207,6 +210,24 @@ in pkgs.lib.fix(self: {
         }
       '';
     };
+
+    virtualHosts.cgit = {
+      serverName = "git.camden.tazj.in";
+      useACMEHost = "camden.tazj.in";
+      addSSL = true;
+
+      extraConfig = ''
+        # Static assets must always hit the root.
+        location ~ ^/(favicon\.ico|cgit\.(css|png))$ {
+           proxy_pass http://localhost:2448;
+        }
+
+        # Everything else hits the depot directly.
+        location / {
+            proxy_pass http://localhost:2448/cgit.cgi/depot/;
+        }
+      '';
+    };
   };
 
   system.stateVersion = "19.09";