Added forgejo(git server)

This commit is contained in:
Reudy 2026-09-26 19:00:28 +02:00
parent 2028769f92
commit 4143768c45
3 changed files with 49 additions and 0 deletions

42
forgejo.nix Normal file
View file

@ -0,0 +1,42 @@
{ config, ... }:
let
domain = "git.srazka.com";
sshPort = 14922;
in
{
services.forgejo = {
enable = true;
# SQLite is plenty for a single-user VPS, same as Nextcloud/Authelia.
database.type = "sqlite3";
# Git LFS support for large files.
lfs.enable = true;
settings = {
server = {
DOMAIN = domain;
ROOT_URL = "https://${domain}/";
# Caddy terminates TLS and proxies to this; not reachable from outside.
HTTP_ADDR = "127.0.0.1";
HTTP_PORT = 14921;
# Forgejo's built-in SSH server, separate from the system sshd (which
# only allows 'reudy' on 14902). Clone URLs look like:
# ssh://git@git.srazka.com:14922/<user>/<repo>.git
START_SSH_SERVER = true;
SSH_PORT = sshPort;
SSH_LISTEN_PORT = sshPort;
BUILTIN_SSH_SERVER_USER = "git";
};
# Private instance — create accounts with the admin CLI instead.
service.DISABLE_REGISTRATION = true;
session.COOKIE_SECURE = true;
};
};
networking.firewall.allowedTCPPorts = [ sshPort ];
}