{ config, lib, ... }: let port = lib.custom.autoport "octoprint"; in { services.caddy.virtualHosts."octoprint.wanderingcrow.net".extraConfig = '' @auth { path /caddy-security/* } route @auth { authenticate with myportal } route /* { authorize with octoprint reverse_proxy http://localhost:${builtins.toString config.services.octoprint.port} } ''; services.octoprint = { inherit port; enable = true; openFirewall = true; }; }