Just guessing, never tried anything like it, but you could try pre generating the sources for the platforms you want with something like [cross compiling](https://nim-lang.org/docs/nimc.html#cross-compilation) and then detect the one to compile with R?
It would be similar to how Nim does bootstrapping with csources.
