diff --git a/modules/foundry.nix b/modules/foundry.nix new file mode 100644 index 0000000..35a981c --- /dev/null +++ b/modules/foundry.nix @@ -0,0 +1,34 @@ +{ lib, config, ... }: + +let + cfg = config.permafrost.foundry; +in +{ + options.permafrost.foundry = { + enable = lib.mkEnableOption "foundry nixos module"; + }; + + config = lib.mkIf cfg.enable { + permafrost.nginx.enable = lib.mkDefault true; + services.nginx.virtualHosts."scarlet.zynh.me" = { + addSSL = true; + serverName = "scarlet.zynh.me"; + locations."/" = { + extraConfig = /* nginx */ '' + # Set proxy headers + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # These are important to support WebSockets + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + + # Make sure to set your Foundry VTT port number + proxy_pass http://localhost:30000; + ''; + proxyPass = "http://localhost:30000"; + }; + }; + }; +}