Setup dependency on compileClassPath fileCollection

I have a custom Configuration called myConf. I want to setup a dependency on the output of a different sourceSet lets call it mySourceSet.

I know this can be done in my groovy build file as shown below.

dependencies {
   myConf sourceSets.mySourceSet.output
}

how can I achieve this in my kotlin based Gradle plugin?
I am able to get my custom Configuration and the SourceSets as shown below
But I am not sure how can I wire them up

val conf = configurations.getByName("myConf")
val ssContainer = extensions.findByType(SourceSetContainer::class.java)!!
val mySourceSet = ssContainer.findByName("mySourceSet")!!

the org.gradle.api.artifacts.Configuration interface doesn’t support any methods to add a FileCollection as a dependency …

If you applied the ´kotlin-dslplugin or manually depended onkotlinDsl()`, you can just do the same:

dependencies {
    conf(mySourceSet.output)
}

Otherwise you can use the “normal” API:

dependencies.add(conf.name, mySourceSet.output)