It is possible to change the mirror interactively via R's options() command, but difficult to do so in a way that is durable across R versions and environments, especially for server administrators.
We should make it possible for the repositories to be set via an external mechanism, so that a hosting environment can tell the R kernel which CRAN mirror(s) to use by default. This is important in many organizations for performance reasons (e.g. using pre-built binaries) as well as security and compliance (e.g. using only approved/validated R packages).
Implementation notes:
This should take the form of a command or configuration in the positron-r extension that can be exposed to other extensions
It would be nice, though not required, if this work resulted in a better configuration experience for package repositories in Positron (e.g. in Settings, a list of mirrors you can see and edit)
This will require supporting work in Ark to accept the repositories in some format (arg? env var? file?) and apply them to the options() at startup.
The R kernel always sets
cran.rstudio.com
as the default CRAN mirror. This logic lives here:https://github.com/posit-dev/ark/blob/4e37e46787ccf7c6a6142e705465580e87f3f0c5/crates/ark/src/modules/positron/options.R#L29-L44
It is possible to change the mirror interactively via R's
options()
command, but difficult to do so in a way that is durable across R versions and environments, especially for server administrators.We should make it possible for the repositories to be set via an external mechanism, so that a hosting environment can tell the R kernel which CRAN mirror(s) to use by default. This is important in many organizations for performance reasons (e.g. using pre-built binaries) as well as security and compliance (e.g. using only approved/validated R packages).
Implementation notes:
positron-r
extension that can be exposed to other extensionsoptions()
at startup.