dotfiles/nixos/boxes/vpsfree1/gitea.nix

64 lines
1.4 KiB
Nix

{ config, pkgs, inputs, lib, ... }:
let
httpPort = 8083;
sshPort = 22;
domain = "git.cyplo.dev";
baseurl = "https://${domain}";
path = "/var/lib/gitea";
in {
imports = [ ../nginx.nix ];
boot.kernel.sysctl = { "net.ipv4.ip_unprivileged_port_start" = 0; };
systemd.services.systemd-sysctl.enable = lib.mkForce true;
networking.firewall.allowedTCPPorts = [ sshPort ];
services.nginx = {
virtualHosts = {
"${domain}" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:" + toString httpPort;
};
};
};
};
containers.gitea = {
autoStart = true;
forwardPorts = [
{
inherit httpPort;
containerPort = httpPort;
}
{
containerPort = sshPort;
hostPort = sshPort;
}
];
bindMounts = {
"${path}" = {
hostPath = "${path}";
isReadOnly = false;
};
};
config = { config, pkgs, lib, ... }: {
system.stateVersion = "22.05";
services.gitea = {
inherit domain httpPort;
enable = true;
rootUrl = baseurl;
disableRegistration = true;
stateDir = path;
settings = {
server = {
START_SSH_SERVER = true;
SSH_PORT = sshPort;
SSH_LISTEN_PORT = sshPort;
DISABLE_SSH = false;
};
};
};
};
};
}