diff --git a/nixos/boxes/vpsfree1/default.nix b/nixos/boxes/vpsfree1/default.nix index 86489bd1..f928705b 100644 --- a/nixos/boxes/vpsfree1/default.nix +++ b/nixos/boxes/vpsfree1/default.nix @@ -10,6 +10,7 @@ ./cryptpad.nix ./fossil.nix ./foundryvtt.nix + ./gitea.nix ./matrix-front.nix ./rss.nix ./search.nix diff --git a/nixos/boxes/vpsfree1/gitea.nix b/nixos/boxes/vpsfree1/gitea.nix new file mode 100644 index 00000000..997cd529 --- /dev/null +++ b/nixos/boxes/vpsfree1/gitea.nix @@ -0,0 +1,59 @@ +{ config, pkgs, inputs, lib, ... }: +let + httpPort = 8083; + sshPort = 2222; + domain = "git.cyplo.dev"; + baseurl = "https://${domain}"; + path = "/var/lib/gitea"; +in { + imports = [ ../nginx.nix ]; + + networking.firewall.allowedTCPPorts = [ sshPort ]; + services.nginx = { + virtualHosts = { + "${domain}" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://localhost:" + toString httpPort; + }; + }; + }; + }; + + containers.gitea = { + autoStart = true; + forwardPorts = [ + { + containerPort = httpPort; + hostPort = httpPort; + } + { + containerPort = sshPort; + hostPort = sshPort; + } + ]; + bindMounts = { + "${path}" = { + hostPath = "${path}"; + isReadOnly = false; + }; + }; + config = { config, pkgs, ... }: { + system.stateVersion = "22.05"; + services.gitea = { + enable = true; + domain = domain; + rootUrl = baseurl; + httpPort = httpPort; + disableRegistration = true; + stateDir = path; + ssh = { + enable = true; + clonePort = sshPort; + }; + settings = { server = { START_SSH_SERVER = true; }; }; + }; + }; + }; +}