From 1094306aa95476a16f28083d4e903bb3e5c2b3dc Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 22 Jun 2022 19:24:35 +0300 Subject: 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 --- ops/modules/cgit.nix | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 ops/modules/cgit.nix (limited to 'ops/modules/cgit.nix') diff --git a/ops/modules/cgit.nix b/ops/modules/cgit.nix new file mode 100644 index 000000000000..25318d1d723e --- /dev/null +++ b/ops/modules/cgit.nix @@ -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; + }; + }; + }; + }; +} -- cgit 1.4.1