dotfiles/nixos/boxes/vpsfree1/gitea.nix

64 lines
1.4 KiB
Nix
Raw Normal View History

2022-10-25 21:23:22 +01:00
{ config, pkgs, inputs, lib, ... }:
let
httpPort = 8083;
sshContainerPort = 22222;
sshHostPort = 22;
2022-10-25 21:23:22 +01:00
domain = "git.cyplo.dev";
baseurl = "https://${domain}";
path = "/var/lib/gitea";
in {
imports = [ ../nginx.nix ];
networking.firewall.allowedTCPPorts = [ sshHostPort ];
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 = [
{
containerPort = httpPort;
hostPort = httpPort;
}
{
containerPort = sshContainerPort;
hostPort = sshHostPort;
2022-10-25 21:23:22 +01:00
}
];
bindMounts = {
"${path}" = {
hostPath = "${path}";
isReadOnly = false;
};
};
config = { config, pkgs, lib, ... }: {
2022-10-25 21:23:22 +01:00
system.stateVersion = "22.05";
services.gitea = {
enable = true;
domain = domain;
rootUrl = baseurl;
httpPort = httpPort;
disableRegistration = true;
stateDir = path;
settings = {
server = {
START_SSH_SERVER = true;
SSH_PORT = sshHostPort;
SSH_LISTEN_PORT = sshContainerPort;
DISABLE_SSH = false;
};
2022-10-25 21:23:22 +01:00
};
};
};
};
}