`kotlinc-native` compilation error on "hello world"

I’m checking out kotlin. Running the hello world example at Get started with Kotlin/Native using the command-line compiler | Kotlin Documentation fails with

$ kotlinc-native hello.kt -o hello
error: compilation failed: /nix/store/zcxx8z1kgqfiv7n0j2yaz6hkb5z5gbqg-kotlin-native-1.9.23/klib/cache/linux_x64STATIC-pl: Read-only file system

How to specify an alternative cache directory?