about summary refs log tree commit diff
path: root/ops/modules/cheddar.nix
diff options
context:
space:
mode:
Diffstat (limited to 'ops/modules/cheddar.nix')
-rw-r--r--ops/modules/cheddar.nix29
1 files changed, 29 insertions, 0 deletions
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";
+      };
+    };
+  };
+}