refactor(web/cgit-tvl): Move cgit config back out of module

It occured to me yesterday that with the config inside of the module
it is kind of difficult to test cgit locally.

This moves it back to a separate location (//web/cgit-tvl) and makes
the most important things configurable via overrides.

Change-Id: I9b0f4c60b75c31441e1718e63b5b55aba3100aae
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5893
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Vincent Ambo 2022-06-22 19:24:35 +03:00 committed by tazjin
parent 32b75c45c5
commit 1094306aa9
4 changed files with 62 additions and 42 deletions

39
ops/modules/cgit.nix Normal file
View file

@ -0,0 +1,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;
};
};
};
};
}