about summary refs log tree commit diff
path: root/ops/modules/cgit.nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-06-22T16·24+0300
committertazjin <tazjin@tvl.su>2022-06-27T14·15+0000
commit1094306aa95476a16f28083d4e903bb3e5c2b3dc (patch)
tree17fbb2d8bbe028d28df686d22d3da6656a00a386 /ops/modules/cgit.nix
parent32b75c45c527ec4469e6f0848e3b097c2f7b1fd6 (diff)
refactor(web/cgit-tvl): Move cgit config back out of module r/4254
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>
Diffstat (limited to 'ops/modules/cgit.nix')
-rw-r--r--ops/modules/cgit.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/ops/modules/cgit.nix b/ops/modules/cgit.nix
new file mode 100644
index 0000000000..25318d1d72
--- /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;
+        };
+      };
+    };
+  };
+}