2022-10-25 21:23:22 +01:00
|
|
|
{ config, pkgs, inputs, lib, ... }:
|
|
|
|
let
|
|
|
|
httpPort = 8083;
|
2022-10-30 19:24:46 +00:00
|
|
|
sshPort = 22;
|
2022-10-25 21:23:22 +01:00
|
|
|
domain = "git.cyplo.dev";
|
|
|
|
baseurl = "https://${domain}";
|
|
|
|
path = "/var/lib/gitea";
|
|
|
|
in {
|
|
|
|
imports = [ ../nginx.nix ];
|
|
|
|
|
2022-10-30 19:24:46 +00:00
|
|
|
boot.kernel.sysctl = { "net.ipv4.ip_unprivileged_port_start" = 0; };
|
|
|
|
systemd.services.systemd-sysctl.enable = lib.mkForce true;
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [ sshPort ];
|
2022-10-25 21:23:22 +01:00
|
|
|
services.nginx = {
|
|
|
|
virtualHosts = {
|
|
|
|
"${domain}" = {
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://localhost:" + toString httpPort;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
containers.gitea = {
|
|
|
|
autoStart = true;
|
|
|
|
forwardPorts = [
|
|
|
|
{
|
2022-11-08 17:06:20 +00:00
|
|
|
inherit httpPort;
|
2022-10-25 21:23:22 +01:00
|
|
|
containerPort = httpPort;
|
|
|
|
}
|
|
|
|
{
|
2022-10-30 19:24:46 +00:00
|
|
|
containerPort = sshPort;
|
|
|
|
hostPort = sshPort;
|
2022-10-25 21:23:22 +01:00
|
|
|
}
|
|
|
|
];
|
|
|
|
bindMounts = {
|
|
|
|
"${path}" = {
|
|
|
|
hostPath = "${path}";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
};
|
2022-10-29 22:44:34 +01:00
|
|
|
config = { config, pkgs, lib, ... }: {
|
2022-10-25 21:23:22 +01:00
|
|
|
system.stateVersion = "22.05";
|
|
|
|
services.gitea = {
|
2022-11-08 17:06:20 +00:00
|
|
|
inherit domain httpPort;
|
2022-10-25 21:23:22 +01:00
|
|
|
enable = true;
|
|
|
|
rootUrl = baseurl;
|
|
|
|
stateDir = path;
|
2022-10-29 22:44:34 +01:00
|
|
|
settings = {
|
2022-12-02 20:35:46 +00:00
|
|
|
service.DISABLE_REGISTRATION = true;
|
2022-10-29 22:44:34 +01:00
|
|
|
server = {
|
|
|
|
START_SSH_SERVER = true;
|
2022-10-30 19:24:46 +00:00
|
|
|
SSH_PORT = sshPort;
|
|
|
|
SSH_LISTEN_PORT = sshPort;
|
2022-10-29 22:44:34 +01:00
|
|
|
DISABLE_SSH = false;
|
2022-12-03 16:41:55 +00:00
|
|
|
LFS_START_SERVER = true;
|
2022-10-29 22:44:34 +01:00
|
|
|
};
|
2022-10-25 21:23:22 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|