about summary refs log tree commit diff
path: root/ops/nixos
diff options
context:
space:
mode:
Diffstat (limited to 'ops/nixos')
-rw-r--r--ops/nixos/whitby/default.nix8
-rw-r--r--ops/nixos/www/cache.tvl.su.nix26
2 files changed, 34 insertions, 0 deletions
diff --git a/ops/nixos/whitby/default.nix b/ops/nixos/whitby/default.nix
index dd8807cf7222..f7d8f4ef4a44 100644
--- a/ops/nixos/whitby/default.nix
+++ b/ops/nixos/whitby/default.nix
@@ -24,6 +24,7 @@ in lib.fix(self: {
     "${depot.depotPath}/ops/nixos/tvl-slapd/default.nix"
     "${depot.depotPath}/ops/nixos/tvl-sso/default.nix"
     "${depot.depotPath}/ops/nixos/www/b.tvl.fyi.nix"
+    "${depot.depotPath}/ops/nixos/www/cache.tvl.su.nix"
     "${depot.depotPath}/ops/nixos/www/cl.tvl.fyi.nix"
     "${depot.depotPath}/ops/nixos/www/code.tvl.fyi.nix"
     "${depot.depotPath}/ops/nixos/www/cs.tvl.fyi.nix"
@@ -307,6 +308,13 @@ in lib.fix(self: {
     ];
   };
 
+  services.nix-serve = {
+    enable = true;
+    port = 6443;
+    secretKeyFile = "/etc/secrets/nix-cache-key.sec";
+    bindAddress = "localhost";
+  };
+
   environment.systemPackages = with nixpkgs; [
     bb
     curl
diff --git a/ops/nixos/www/cache.tvl.su.nix b/ops/nixos/www/cache.tvl.su.nix
new file mode 100644
index 000000000000..182306bebff1
--- /dev/null
+++ b/ops/nixos/www/cache.tvl.su.nix
@@ -0,0 +1,26 @@
+{ config, ... }:
+
+{
+  imports = [
+    ./base.nix
+  ];
+
+  config = {
+    services.nginx.virtualHosts."cache.tvl.su" = {
+      serverName = "cache.tvl.su";
+      serverAliases = [ "cache.tvl.fyi" ];
+      enableACME = true;
+      forceSSL = true;
+
+      extraConfig = ''
+        location = /cache-key.pub {
+          alias /etc/secrets/nix-cache-key.pub;
+        }
+
+        location / {
+          proxy_pass http://localhost:${toString config.services.nix-serve.port};
+        }
+      '';
+    };
+  };
+}