If I understand your question (you want your Wikimedia and Nextcloud servers to use Discourse has the SSO source), then you’d need to find or develop DiscourseConnect plugins for each of those services. See Use Discourse as an identity provider (SSO, DiscourseConnect). wp-discourse is a working php example (that works for WordPress, obviously).