Add git server

This commit is contained in:
Charlotte Van Petegem 2023-01-22 21:42:09 +01:00
parent faec7247c4
commit 31cf4df2c6
No known key found for this signature in database
GPG key ID: 019E764B7184435A
4 changed files with 98 additions and 0 deletions

View file

@ -7,6 +7,7 @@
./data-access
./deluge
./garmin-scraper
./git
./grafana
./mail
./mastodon

View file

@ -0,0 +1,86 @@
{ config, lib, pkgs, ... }:
{
options.chvp.services.git.enable = lib.mkOption {
default = false;
example = true;
};
config = lib.mkIf config.chvp.services.git.enable {
chvp.services.nginx.hosts = [{
fqdn = "git.chvp.be";
options = {
root = pkgs.gitea.data;
locations = {
"/".tryFiles = "$uri @proxy";
"@proxy" = {
proxyPass = "http://unix:/run/gitea/gitea.sock";
proxyWebsockets = true;
};
};
};
}];
users = {
users = {
git = {
uid = 963;
home = "/var/lib/git";
group = "git";
isSystemUser = true;
useDefaultShell = true;
};
nginx.extraGroups = [ "git" ];
};
groups.git.gid = 963;
};
services.openssh.settings.AcceptEnv = "GIT_PROTOCOL";
services.gitea = {
enable = true;
stateDir = "/var/lib/git";
user = "git";
database = {
type = "postgres";
createDatabase = true;
user = "git";
name = "git";
};
dump.enable = true;
lfs.enable = true;
appName = "Charlotte's personal git server";
domain = "git.chvp.be";
rootUrl = "https://git.chvp.be/";
enableUnixSocket = true;
settings = {
repository = {
DEFAULT_PRIVATE = "private";
ENABLE_PUSH_CREATE_USER = true;
ENABLE_PUSH_CREATE_ORG = true;
};
"repository.pull-request".DEFAULT_MERGE_STYLE = "squash";
"repository.mimetype_mapping" = {
".apk" = "application/vnd.android.package-archive";
};
ui.DEFAULT_SHOW_FULL_NAME = true;
security.DISABLE_GIT_HOOKS = false;
service = {
ENABLE_NOTIFY_EMAIL = true;
EMAIL_DOMAIN_WHITELIST = "chvp.be";
REGISTER_EMAIL_CONFIRM = true;
AUTO_WATCH_ON_CHANGES = true;
};
mailer = {
ENABLED = true;
FROM = "git@chvp.be";
PROTOCOL = "smtp";
SMTP_ADDR = "localhost";
SMTP_PORT = 25;
};
session.COOKIE_SECURE = true;
cron = {
ENABLED = true;
SCHEDULE = "@every 1h";
};
};
};
};
}