From f8b22b6a5d2b9bef398a6ee93e5c9844b288b843 Mon Sep 17 00:00:00 2001 From: boyreau Date: Fri, 25 Sep 2026 07:33:58 +0200 Subject: [PATCH] nginx + forgejo + some content on zospace --- machines/homelab/default.nix | 16 ++++------------ machines/homelab/forgejo.nix | 8 ++++++++ machines/homelab/nginx.nix | 30 ++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 12 deletions(-) create mode 100644 machines/homelab/forgejo.nix create mode 100644 machines/homelab/nginx.nix diff --git a/machines/homelab/default.nix b/machines/homelab/default.nix index 62642ba..dcfc682 100644 --- a/machines/homelab/default.nix +++ b/machines/homelab/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ...}: +{ pkgs, ... }: { imports = [ /etc/nixos/modules/nix.nix @@ -7,10 +7,13 @@ /etc/nixos/modules/ssl.nix /etc/nixos/modules/ssh.nix /etc/nixos/modules/tailscale.nix + /etc/nixos/modules/sops.nix /etc/nixos/modules/ipfs ./hardware-configuration.nix ./bootloader.nix + ./nginx.nix + ./forgejo.nix ./user.nix ]; @@ -30,16 +33,5 @@ pkgs.direnv ]; - security.acme.acceptTerms = true; - services.nginx.enable = true; - services.nginx.virtualHosts = { - "zospace.freeboxos.fr" = { - forceSSL = true; - enableACME = true; - locations."/".root = "/var/www/zospace.freeboxos.fr/"; - }; - }; - networking.firewall.allowedTCPPorts = [ 80 443 ]; - system.stateVersion = "26.05"; } diff --git a/machines/homelab/forgejo.nix b/machines/homelab/forgejo.nix new file mode 100644 index 0000000..699612b --- /dev/null +++ b/machines/homelab/forgejo.nix @@ -0,0 +1,8 @@ +{ + services.forgejo = { + enable = true; + settings.server.HTTP_PORT = 8888; + settings.server.DISABLE_SSH = true; + settings.server.ROOT_URL = "https://zospace.freeboxos.fr/forgejo"; + }; +} diff --git a/machines/homelab/nginx.nix b/machines/homelab/nginx.nix new file mode 100644 index 0000000..7d6b99d --- /dev/null +++ b/machines/homelab/nginx.nix @@ -0,0 +1,30 @@ +{ + security.acme.acceptTerms = true; + services.nginx.enable = true; + services.nginx.virtualHosts = { + "zospace.freeboxos.fr" = { + forceSSL = true; + enableACME = true; + + locations."/".root = "/var/www/zospace.freeboxos.fr/"; + + locations."/forgejo/" = { + extraConfig = '' + proxy_set_header Connection $http_connection; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + client_max_body_size 512M; + proxy_pass http://localhost:8888/; + ''; + }; + }; + }; + networking.firewall.allowedTCPPorts = [ + 80 + 443 + ]; +}