72 lines
2 KiB
Nix
72 lines
2 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
{
|
|
options = {
|
|
server.misc.forgejo = {
|
|
enable = lib.mkEnableOption "enable forgejo";
|
|
port = lib.mkOption {
|
|
default = 2934;
|
|
description = "forgejo port";
|
|
};
|
|
public = lib.mkEnableOption "public forgejo";
|
|
subdomain = lib.mkOption {
|
|
default = "git";
|
|
description = "forgejo subdomain";
|
|
};
|
|
settings = {
|
|
app_name = lib.mkOption {
|
|
default = "${config.user.userName}'s code dump";
|
|
description = "forgejo app name";
|
|
};
|
|
app_slogan = lib.mkOption {
|
|
default = "if code could talk, mine would cry";
|
|
description = "forgejo app slogan";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
config = {
|
|
services = {
|
|
forgejo = {
|
|
enable = config.server.misc.forgejo.enable;
|
|
database.type = "postgres";
|
|
settings = {
|
|
server = {
|
|
DOMAIN = "${config.server.misc.forgejo.subdomain}.${config.networking.domain}";
|
|
ROOT_URL = "https://${config.server.misc.forgejo.subdomain}.${config.networking.domain}";
|
|
HTTP_PORT = config.server.misc.forgejo.port;
|
|
};
|
|
DEFAULT = {
|
|
APP_NAME = config.server.misc.forgejo.settings.app_name;
|
|
APP_SLOGAN = config.server.misc.forgejo.settings.app_slogan;
|
|
};
|
|
REPOSITORY = {
|
|
ENABLE_PUSH_CREATE_USER = true;
|
|
ENABLE_PUSH_CREATE_ORG = true;
|
|
|
|
};
|
|
service.DISABLE_REGISTRATION = true;
|
|
};
|
|
};
|
|
nginx = {
|
|
virtualHosts = {
|
|
"${config.server.misc.forgejo.subdomain}.${config.networking.domain}" =
|
|
if config.server.misc.forgejo.public then
|
|
{
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
locations."/" = {
|
|
proxyPass = "http://127.0.0.1:${toString config.server.misc.forgejo.port}";
|
|
};
|
|
}
|
|
else
|
|
{ };
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|