about summary refs log tree commit diff
path: root/ops/modules/cgit.nix
blob: 25318d1d723ef3ef57d1eec79d2091bd4ea68ad6 (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
34
35
36
37
38
39
# Configuration for running the TVL cgit instance using thttpd.
{ config, depot, lib, pkgs, ... }:

let
  cfg = config.services.depot.cgit;
in
{
  options.services.depot.cgit = with lib; {
    enable = mkEnableOption "Run cgit web interface for depot";

    port = mkOption {
      description = "Port on which cgit should listen";
      type = types.int;
      default = 2448;
    };

    repo = mkOption {
      description = "Path to depot's .git folder on the machine";
      type = types.str;
      default = "/var/lib/gerrit/git/depot.git/";
    };
  };

  config = lib.mkIf cfg.enable {
    systemd.services.cgit = {
      wantedBy = [ "multi-user.target" ];

      serviceConfig = {
        Restart = "on-failure";
        User = "git";
        Group = "git";

        ExecStart = depot.web.cgit-tvl.override {
          inherit (cfg) port repo;
        };
      };
    };
  };
}