2024-08-17 12:09:32 +02:00
|
|
|
{ config, lib, ... }:
|
2024-08-12 15:56:45 +02:00
|
|
|
{
|
2024-08-12 17:11:08 +02:00
|
|
|
imports = [ ./forgejo-smtp.nix ];
|
2024-08-12 16:06:40 +02:00
|
|
|
sops.secrets.smtp_address = { };
|
2024-08-12 18:11:49 +02:00
|
|
|
sops.secrets.smtp_password = {
|
|
|
|
owner = "forgejo";
|
|
|
|
};
|
2024-08-17 12:15:13 +02:00
|
|
|
sops.secrets.forgejoInitialMail = {
|
|
|
|
owner = "forgejo";
|
|
|
|
};
|
|
|
|
sops.secrets.forgejoInitialPassword = {
|
|
|
|
owner = "forgejo";
|
|
|
|
};
|
2024-08-12 15:56:45 +02:00
|
|
|
|
|
|
|
services.forgejo = {
|
|
|
|
enable = true;
|
|
|
|
lfs.enable = true;
|
|
|
|
database = {
|
|
|
|
type = "postgres";
|
|
|
|
};
|
2024-08-12 16:06:40 +02:00
|
|
|
settings = {
|
|
|
|
server = {
|
|
|
|
DOMAIN = "git.hypervirtual.world";
|
2024-08-17 12:21:04 +02:00
|
|
|
ROOT_URL = "https://git.hypervirtual.world";
|
2024-08-12 18:13:35 +02:00
|
|
|
HTTP_PORT = 3333;
|
2024-08-12 16:06:40 +02:00
|
|
|
};
|
|
|
|
actions = {
|
|
|
|
ENABLED = true;
|
|
|
|
DEFAULT_ACTIONS_URL = "github";
|
|
|
|
};
|
|
|
|
mailer = {
|
2024-08-12 15:56:45 +02:00
|
|
|
ENABLED = true;
|
|
|
|
};
|
2024-08-12 16:08:22 +02:00
|
|
|
service.DISABLE_REGISTRATION = true;
|
2024-08-12 16:06:40 +02:00
|
|
|
};
|
2024-08-12 15:56:45 +02:00
|
|
|
mailerPasswordFile = config.sops.secrets.smtp_password.path;
|
|
|
|
};
|
2024-08-17 12:09:32 +02:00
|
|
|
|
|
|
|
systemd.services.forgejo.preStart = ''
|
|
|
|
create="${lib.getExe config.services.forgejo.package} admin user create"
|
2024-08-17 12:10:45 +02:00
|
|
|
$create --admin --email "`cat ${config.sops.secrets.forgejoInitialMail.path}`" --username you --password "`cat ${config.sops.secrets.forgejoInitialPassword.path}`" &>/dev/null || true
|
2024-08-17 12:09:32 +02:00
|
|
|
'';
|
2024-10-30 17:44:54 +01:00
|
|
|
|
|
|
|
services.caddy.virtualHosts."http://git.hypervirtual.world".extraConfig = ''
|
|
|
|
reverse_proxy :3333
|
|
|
|
'';
|
2024-08-12 15:56:45 +02:00
|
|
|
}
|