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.
51 lines
No EOL
1 KiB
Nix
51 lines
No EOL
1 KiB
Nix
{ config, pkgs, domain, ... }:
|
|
|
|
{
|
|
# Set hostname (passed as parameter)
|
|
networking.hostName = domain;
|
|
|
|
# System packages
|
|
environment.systemPackages = with pkgs; [
|
|
vim
|
|
git
|
|
htop
|
|
];
|
|
|
|
# Enable SSH
|
|
services.openssh.enable = true;
|
|
|
|
# Enable and configure nginx
|
|
services.nginx = {
|
|
enable = true;
|
|
|
|
# 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";
|
|
};
|
|
};
|
|
};
|
|
|
|
# Open firewall for HTTP/HTTPS
|
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
|
|
|
# NixOS release version
|
|
system.stateVersion = "25.05";
|
|
} |