{ nextcloudPackage, nextcloudHost, nextcloudHostname, ... }: { config, lib, pkgs, ... }: with lib; let hostname = config.instance.hostname; host = config.fudo.hosts."${hostname}"; isNextcloud = hostname == nextcloudHost; port = config.services.nextcloudContainer.port; in { config = mkIf isNextcloud { services = { nextcloudContainer = { enable = true; hostname = nextcloudHostname; package = nextcloudPackage; extra-apps = with config.services.nextcloudContainer.package.packages.apps; { inherit news contacts calendar tasks maps memories mail bookmarks files_markdown notes unsplash user_saml; }; timezone = "America/Winnipeg"; }; nginx = { enable = true; recommendedOptimisation = true; recommendedGzipSettings = true; recommendedProxySettings = true; virtualHosts."${nextcloudHostname}" = { enableACME = true; forceSSL = true; locations."/" = { proxyPass = "http://localhost:${toString port}"; proxyWebsockets = true; }; }; }; }; }; }