{ lib, config, ... }: let enabled = config.mod.whib-frontend.enable; in { options = { mod.whib-frontend = { enable = lib.mkEnableOption "enable WHIB backend"; }; }; config = lib.mkIf enabled { services.whib-frontend = { enable = true; # nginx serves the frontend; matches the Host header of http://localhost:8081 domain = "localhost"; # backendHost = "https://api.whib.ppp.pm/"; backendHost = "http://localhost:8080"; }; networking.firewall.allowedTCPPorts = [ 80 ]; virtualisation.vmVariant = { virtualisation = { forwardPorts = [ { # Frontend served by nginx from = "host"; host.port = 8081; guest.port = 80; } ]; }; }; }; }