{ lib, ... }: { _class = "clan.service"; manifest.name = "stirling-pdf"; manifest.description = "Your locally hosted one-stop-shop for all your PDF needs."; manifest.categories = [ "System" ]; roles.default = { interface.options = { domain = lib.mkOption { type = lib.types.str; default = "pdf"; description = "Sub domain or Stirling PDF service"; }; }; perInstance = { settings, ... }: { nixosModule = { config, ... }: let domain = "${settings.domain}.${config.networking.fqdn}"; in { services.stirling-pdf = { enable = true; environment = { SERVER_PORT = 8080; }; }; services.nginx.virtualHosts."${domain}" = { forceSSL = true; useACMEHost = "${config.networking.fqdn}"; locations."/" = { proxyPass = "http://localhost:${builtins.toString config.services.stirling-pdf.environment.SERVER_PORT}"; }; }; }; }; }; }