about summary refs log tree commit diff
path: root/ops/modules/git-serving.nix
blob: 57f08cbc5f45ada8b969fea1e7967710ac46d8dd (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
30
31
32
33
# Configures the public josh instance for serving the depot.
{ config, depot, lib, pkgs, ... }:

let
  cfg = config.services.depot.git-serving;
in
{
  options.services.depot.git-serving = with lib; {
    enable = mkEnableOption "Enable cgit & josh configuration";

    joshPort = mkOption {
      description = "Port on which josh should listen";
      type = types.int;
      default = 5674;
    };
  };

  config = lib.mkIf cfg.enable {
    # Run josh for the depot.
    systemd.services.josh = {
      description = "josh - partial cloning of monorepos";
      wantedBy = [ "multi-user.target" ];
      path = [ pkgs.git pkgs.bash ];

      serviceConfig = {
        DynamicUser = true;
        StateDirectory = "josh";
        Restart = "always";
        ExecStart = "${depot.third_party.josh}/bin/josh-proxy --no-background --local /var/lib/josh --port ${toString cfg.joshPort} --remote https://cl.tvl.fyi/";
      };
    };
  };
}