So, since that is already possible right now (not only with nextcloud), your “integration” would be to have an SSO between the two? That should also be possible already.
For me, the most important aspect of integration would be how those links to nextcloud documents are rendered in discourse. That could be anything from improved (possibly customizable) oneboxing to full viewing capabilities (within post or in a modal) to full editing capabilities to the possibility of using discourse to annotate and discuss documents (i.e. to be able to quote/refer to parts of a nextcloud document in discourse…