about summary refs log tree commit diff
path: root/ops/modules/cheddar.nix
blob: 8c30369789884b07b3fb9c349079146d1fe0f1e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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";
      };
    };
  };
}