2020-06-07 20:30:52 +02:00
|
|
|
# Gerrit configuration for the TVL monorepo
|
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
|
2020-06-11 00:40:34 +02:00
|
|
|
let cfg = config.services.gerrit;
|
|
|
|
in {
|
2020-06-07 20:30:52 +02:00
|
|
|
services.gerrit = {
|
|
|
|
enable = true;
|
|
|
|
listenAddress = "[::]:4778"; # 4778 - grrt
|
|
|
|
serverId = "4fdfa107-4df9-4596-8e0a-1d2bbdd96e36";
|
|
|
|
settings = {
|
|
|
|
core.packedGitLimit = "100m";
|
|
|
|
log.jsonLogging = true;
|
|
|
|
log.textLogging = false;
|
2020-06-11 00:40:34 +02:00
|
|
|
|
|
|
|
# Configures gerrit for being reverse-proxied by nginx as per
|
|
|
|
# https://gerrit-review.googlesource.com/Documentation/config-reverseproxy.html
|
|
|
|
gerrit.canonicalWebUrl = "https://cl.tvl.fyi";
|
|
|
|
httpd.listenUrl = "proxy-https://${cfg.listenAddress}";
|
2020-06-08 02:35:45 +02:00
|
|
|
|
2020-06-11 23:49:37 +02:00
|
|
|
# Configure for cgit.
|
|
|
|
gitweb = {
|
|
|
|
type = "custom";
|
|
|
|
url = "https://git.tazj.in";
|
|
|
|
project = "/";
|
|
|
|
revision = "/commit/?id=\${commit}";
|
|
|
|
branch = "/log/?h=\${branch}";
|
|
|
|
tag = "/tag/?h=\${tag}";
|
|
|
|
roottree = "/tree/?h=\${commit}";
|
|
|
|
file = "/tree/\${file}?h=\${commit}";
|
|
|
|
filehistory = "/log/\${file}?h=\${branch}";
|
|
|
|
linkname = "cgit";
|
|
|
|
};
|
|
|
|
|
2020-06-08 02:35:45 +02:00
|
|
|
# Configures integration with the locally running OpenLDAP
|
|
|
|
auth.type = "LDAP";
|
|
|
|
ldap = {
|
|
|
|
server = "ldap://localhost";
|
|
|
|
accountBase = "ou=users,dc=tvl,dc=fyi";
|
|
|
|
accountPattern = "(&(objectClass=organizationalPerson)(cn=\${username}))";
|
|
|
|
accountFullName = "cn";
|
|
|
|
accountEmailAddress = "mail";
|
2020-06-11 01:04:05 +02:00
|
|
|
accountSshUserName = "cn";
|
2020-06-08 02:35:45 +02:00
|
|
|
groupBase = "ou=groups,dc=tvl,dc=fyi";
|
|
|
|
|
|
|
|
# TODO(tazjin): Assuming this is what we'll be doing ...
|
|
|
|
groupMemberPattern = "(&(objectClass=group)(member=\${dn}))";
|
|
|
|
};
|
2020-06-07 20:30:52 +02:00
|
|
|
};
|
|
|
|
};
|
2020-06-11 23:47:41 +02:00
|
|
|
|
|
|
|
systemd.services.gerrit = {
|
|
|
|
serviceConfig = {
|
|
|
|
# There seems to be no easy way to get `DynamicUser` to play
|
|
|
|
# well with other services (e.g. by using SupplementaryGroups,
|
|
|
|
# which seem to have no effect) so we force the DynamicUser
|
|
|
|
# setting for the Gerrit service to be disabled and reuse the
|
|
|
|
# existing 'git' user.
|
|
|
|
DynamicUser = lib.mkForce false;
|
|
|
|
User = "git";
|
|
|
|
Group = "git";
|
|
|
|
};
|
|
|
|
};
|
2020-06-07 20:30:52 +02:00
|
|
|
}
|