feat(self_host/git): moving from gitea to forgejo

This commit is contained in:
Raphael 2025-12-25 01:26:50 +01:00
parent 94af056548
commit 997042d9be
No known key found for this signature in database

View file

@ -1,20 +1,20 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
giteaDomain = "git.enium.eu"; gitDomain = "git.enium.eu";
in in
{ {
services.gitea = { services = {
forgejo = {
enable = true; enable = true;
appName = "Enium Git"; database.type = "postgres";
user = "gitea";
group = "gitea";
database.type = "sqlite3";
settings = { settings = {
server = { server = {
DOMAIN = giteaDomain; "DEFAULT.APP_NAME" = "Enium Git";
ROOT_URL = "https://${giteaDomain}/"; "DEFAULT.APP_SLOGAN" = "Born2Code";
DOMAIN = gitDomain;
ROOT_URL = "https://${gitDomain}/";
SSH_PORT = 42131; SSH_PORT = 42131;
HTTP_ADDR = "127.0.0.1"; HTTP_ADDR = "127.0.0.1";
HTTP_PORT = 3042; HTTP_PORT = 3042;
@ -24,26 +24,34 @@ in
DISABLE_REGULAR_LOGIN = true; DISABLE_REGULAR_LOGIN = true;
}; };
service = { oauth2 = {
DISABLE_REGISTRATION = true; ENABLED = true;
ALLOW_ONLY_EXTERNAL_REGISTRATION = true; NAME = "Enium";
}; CLIENT_ID = "forgejo";
CLIENT_SECRET = "${config.age.secrets.forgejo-oidc-secret.path}";
web = { SCOPES = "openid email profile groups";
DISABLE_LOCAL_LOGIN = true; LOGIN_ATTRIBUTE_PATH = "preferred_username";
}; AUTH_URL = "https://git.enium.eu/ui/oauth2";
TOKEN_URL = "https://git.enium.eu/oauth2/token";
oauth2_client = { API_URL = "https://git.enium.eu/oauth2/openid/forgejo/userinfo";
CODE_CHALLENGE_METHOD = "S256";
ENABLE_AUTO_REGISTRATION = true; ENABLE_AUTO_REGISTRATION = true;
UPDATE_AVATAR = true;
};
security = {
LOGIN_REMEMBER_DAYS = 14;
}; };
}; };
}; };
services.nginx.virtualHosts."${giteaDomain}" = { nginx.virtualHosts."${gitDomain}" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations."/" = {
proxyPass = "http://127.0.0.1:3042"; proxyPass = "http://127.0.0.1:3042";
proxyWebsockets = true;
};
}; };
}; };
} }