The only change that you have to apply is the following:
implementation(libs.room.runtime) ---> api(libs.room.runtime)
Then libs.room.runtime will be accessible in any source sets.