flake/modules/services/forgejo.nix

51 lines
1.2 KiB
Nix
Raw Permalink Normal View History

2024-10-29 08:55:56 +01:00
{
pkgs,
lib,
config,
cfg,
...
}:
with lib;
with builtins; {
2024-09-17 03:10:20 +02:00
opt.domain = lib.mkOption {type = lib.types.str;};
2024-09-01 00:06:13 +02:00
services.forgejo = {
enable = true;
package = config.pkgsInstances.unstable.forgejo;
2024-09-01 00:06:13 +02:00
settings.server = {
2024-09-17 02:46:45 +02:00
ROOT_URL = "https://${cfg.domain}";
DOMAIN = cfg.domain;
2024-09-01 00:06:13 +02:00
HTTP_PORT = 48540;
OFFLINE_MODE = true; # disable gravatar, CDN
};
settings.actions = {
2024-10-29 08:55:56 +01:00
ENABLED = true;
2024-09-01 00:06:13 +02:00
};
settings."repository.upload" = {
2024-10-29 08:55:56 +01:00
FILE_MAX_SIZE = 4095;
MAX_FILES = 20;
2024-09-01 00:06:13 +02:00
};
settings."attachment" = {
2024-10-29 08:55:56 +01:00
MAX_SIZE = 4095;
MAX_FILES = 20;
2024-09-01 00:06:13 +02:00
};
settings.service = {
2024-10-29 08:55:56 +01:00
DISABLE_REGISTRATION = true;
DEFAULT_KEEP_EMAIL_PRIVATE = true;
2024-09-01 00:06:13 +02:00
};
database = {
user = "forgejo";
2024-09-06 02:01:59 +02:00
passwordFile = config.sops.secrets."hosts/forgenite/forgejo_db_password".path;
2024-09-01 00:06:13 +02:00
name = "forgejodb";
type = "mysql";
};
};
# Allow forgejo user to adjust authorized_keys dynamically
services.openssh.extraConfig = ''
Match User forgejo
AuthorizedKeysFile ${config.users.users.forgejo.home}/.ssh/authorized_keys
'';
networking.firewall.allowedTCPPorts = [48540];
2024-09-05 21:11:15 +02:00
}