From e39913007289aa761308ce5ac7163cff51054d40 Mon Sep 17 00:00:00 2001 From: padreug Date: Wed, 8 Oct 2025 17:11:27 +0200 Subject: [PATCH] Refactor shared Nix configuration to use domain parameter Updated the shared Nix configuration to replace the hostname parameter with a domain parameter, allowing for more flexible virtual host configurations. Adjusted machine1 and machine2 configurations to reflect this change, ensuring proper domain usage for Nginx virtual hosts, including new entries for web-app, LNbits, and image services. --- config/shared.nix | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/config/shared.nix b/config/shared.nix index c28b8e7..29c0104 100644 --- a/config/shared.nix +++ b/config/shared.nix @@ -1,8 +1,8 @@ -{ config, pkgs, hostName, ... }: +{ config, pkgs, domain, ... }: { # Set hostname (passed as parameter) - networking.hostName = hostName; + networking.hostName = domain; # System packages environment.systemPackages = with pkgs; [ @@ -17,10 +17,28 @@ # Enable and configure nginx services.nginx = { enable = true; - virtualHosts."${hostName}" = { + + # Web-app service + virtualHosts."app.${domain}" = { root = "/var/src/web-app-dist"; locations."/" = { index = "index.html"; + tryFiles = "$uri $uri/ /index.html"; + }; + }; + + # LNbits service (example - adjust as needed) + virtualHosts."lnbits.${domain}" = { + locations."/" = { + proxyPass = "http://localhost:5000"; + proxyWebsockets = true; + }; + }; + + # Image service (example - adjust as needed) + virtualHosts."img.${domain}" = { + locations."/" = { + proxyPass = "http://localhost:8080"; }; }; };