2022-06-22 18:24:35 +02:00
|
|
|
# Configuration for running the TVL cgit instance using thttpd.
|
|
|
|
{ config, depot, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.depot.cgit;
|
2022-07-11 13:15:14 +02:00
|
|
|
|
|
|
|
userConfig =
|
|
|
|
if builtins.isNull cfg.user then {
|
|
|
|
DynamicUser = true;
|
|
|
|
} else {
|
|
|
|
User = cfg.user;
|
|
|
|
Group = cfg.user;
|
|
|
|
};
|
2022-06-22 18:24:35 +02:00
|
|
|
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/";
|
|
|
|
};
|
2022-07-11 13:15:14 +02:00
|
|
|
|
|
|
|
user = mkOption {
|
|
|
|
description = ''
|
|
|
|
User to use for the cgit service. It is expected that this is
|
|
|
|
also the name of the user's primary group.
|
|
|
|
'';
|
|
|
|
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = null;
|
|
|
|
};
|
2022-06-22 18:24:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
systemd.services.cgit = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Restart = "on-failure";
|
|
|
|
|
|
|
|
ExecStart = depot.web.cgit-tvl.override {
|
|
|
|
inherit (cfg) port repo;
|
|
|
|
};
|
2022-07-11 13:15:14 +02:00
|
|
|
} // userConfig;
|
2022-06-22 18:24:35 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|