54 lines
1.2 KiB
Nix
54 lines
1.2 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
inherit (lib) mkIf;
|
|
|
|
cfg = config.pepe.services.gitea;
|
|
in
|
|
{
|
|
options.pepe.services.gitea = with lib; {
|
|
enable = mkEnableOption "Enable gitea";
|
|
package = mkPackageOption pkgs "gitea" { };
|
|
domain = mkOption {
|
|
type = types.str;
|
|
default = null;
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
pepe.core = {
|
|
firewall.openTCP = [ config.services.gitea.settings.server.SSH_PORT ];
|
|
vhost.hosts.${cfg.domain} = {
|
|
locations."/" = {
|
|
port = config.services.gitea.settings.server.HTTP_PORT;
|
|
allowLAN = true;
|
|
allowVPN = true;
|
|
allowWAN = true;
|
|
};
|
|
};
|
|
};
|
|
|
|
services.gitea = {
|
|
enable = true;
|
|
package = cfg.package;
|
|
database.type = "sqlite3";
|
|
appName = "Gitea";
|
|
# https://github.com/NixOS/nixpkgs/issues/235442#issuecomment-1574329453
|
|
lfs.enable = true;
|
|
settings = {
|
|
server = {
|
|
DOMAIN = cfg.domain;
|
|
ROOT_URL = "https://${cfg.domain}";
|
|
SSH_PORT = 22;
|
|
HTTP_PORT = 3001;
|
|
};
|
|
service = {
|
|
DISABLE_REGISTRATION = true;
|
|
};
|
|
|
|
};
|
|
};
|
|
|
|
};
|
|
}
|