about summary refs log tree commit diff
path: root/ops
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@tvl.su>2024-08-23T15·24+0300
committertazjin <tazjin@tvl.su>2024-08-23T23·41+0000
commitbfab474d0ce07968673fd516cab1469e02050038 (patch)
tree17f59e684693af2af6042d91f719020e4db5ccb8 /ops
parent8b624f93bf05d061dba2cd9e7793d9ebf183a4a1 (diff)
fix(ops/modules): re-add cheddar highlighting server r/8573
This was deleted when removing the Sourcegraph module, but it turns out it is
also needed by panettone.

Change-Id: I8f14165bf783743247894c2b64882fbb032ffbf8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12295
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'ops')
-rw-r--r--ops/machines/whitby/default.nix4
-rw-r--r--ops/modules/cheddar.nix29
2 files changed, 33 insertions, 0 deletions
diff --git a/ops/machines/whitby/default.nix b/ops/machines/whitby/default.nix
index c122ece58480..3181ccde451c 100644
--- a/ops/machines/whitby/default.nix
+++ b/ops/machines/whitby/default.nix
@@ -11,6 +11,7 @@ in
   imports = [
     (mod "atward.nix")
     (mod "cgit.nix")
+    (mod "cheddar.nix")
     (mod "clbot.nix")
     (mod "gerrit-autosubmit.nix")
     (mod "irccat.nix")
@@ -305,6 +306,9 @@ in
     agentCount = 32;
   };
 
+  # Run Markdown/code renderer
+  services.depot.cheddar.enable = true;
+
   # Start a local SMTP relay to Gmail (used by gerrit)
   services.depot.smtprelay = {
     enable = true;
diff --git a/ops/modules/cheddar.nix b/ops/modules/cheddar.nix
new file mode 100644
index 000000000000..8c3036978988
--- /dev/null
+++ b/ops/modules/cheddar.nix
@@ -0,0 +1,29 @@
+{ depot, config, pkgs, lib, ... }:
+
+let
+  cfg = config.services.depot.cheddar;
+  description = "cheddar - markdown/highlighting server";
+in
+{
+  options.services.depot.cheddar = with lib; {
+    enable = mkEnableOption description;
+    port = mkOption {
+      description = "Port on which cheddar should listen";
+      type = types.int;
+      default = 4238;
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    systemd.services.cheddar-server = {
+      inherit description;
+      wantedBy = [ "multi-user.target" ];
+      script = "${depot.tools.cheddar}/bin/cheddar --listen 0.0.0.0:${toString cfg.port} --sourcegraph-server";
+
+      serviceConfig = {
+        DynamicUser = true;
+        Restart = "always";
+      };
+    };
+  };
+}