--- title: "z - Advanced topic: Understanding the rPackages set release cycle and using bleeding edge packages" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{z-advanced-topic-understanding-the-rpackages-set-release-cycle-and-using-bleeding-edge-packages} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` ```{r, include=FALSE} library(rix) ``` ## Introduction It is important to understand the release cycle of the rPackages set and what steps you should take if you need bleeding edge packages. R packages on `nixpkgs` tend to get updated alongside a new release of R, and the reason is to ensure a certain level of quality. The vast majority of CRAN (and Bioconductor) packages are made available through `nixpkgs` in a fully automated way. But some packages do require some manual intervention to work on Nix, and we only know this if we try to build these packages, but building packages requires quite a lot of resources. We can’t build CRAN packages every single day to see if everything works well on Nix, so we only rebuild the whole tree whenever there’s a new release of R. Packages get built on a CI infrastructure called *Hydra*, and then these packages get cached on [cache.nixos.org](https://cache.nixos.org/) so whenever someone wants to install a package, a pre-built binary gets download from the cache. This avoids having to build software from source locally. For packages that don’t need compiling this is not that big of a time save, but for packages that do need to get compiled it is huge. Depending on which packages you want to install, if you had to build everything from source, it could potentially take hours, but if you can install pre-built binaries it’s just a matter of how quick your Internet connection is. ## R packages available through Nix As explained in the introduction, the *rPackages* set on `nixpkgs` gets updated shortly after a new release of R. The process involves first updating the package definitions found [here](https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/r-modules), and then building the whole tree on a CI platform called *Hydra*. Build failures then get fixed by volunteers (to learn how you can contribute, read the `vignette("z-contributing_to_nixpkgs")`). After the most important packages have been fixed, the whole rPackages set gets updated and made available through `nixpkgs` master branch. Essentially this means that if you start a project with `{rix}` using `"latest-upstream"` as the `r_ver` just after the rPackages set got updated, this project will use very fresh packages. But if instead you start a project just before an R release, then the environment will be using older packages. In practice this rarely matters, unless you absolutely need a very recent version of a specific package because you need a specific feature, or if you need an environment with bleeding edge packages for development. For cases like this, we provide the `r_ver = "bleeding-edge"` and `r_ver = "frozen-edge"` options. If you need to test the current development version of R, you can use `r_ver = "r-devel"`, and if you need to test the current development version of Bioconductor use `r_ver = "bioc-devel"` and if you need both the development version of R and Bioconductor use `r_ver = "r-devel-bioc-devel"`. The table below illustrates this more clearly: ```{=html}
r_ver or date | Intended use | State of R version | State of CRAN packages | State of Bioconductor packages | State of other packages in Nixpkgs |
---|---|---|---|---|---|
r_ver = "latest-upstream" | Start of new project where versions don’t matter | Current or previous | Outdated (up to 6 months) | Outdated (up to 6 months) | Current at time of generation |
r_ver = "4.4.2" (or other) | Reproducing old project or starting a new project where versions don’t matter | Same as in `r_ver`, check `available_r()` | Outdated (up to 2 months if using latest release) | Outdated (up to 2 months if using latest release) | Potentially outdated (up to 12 months) |
date = "2024-12-14" | Reproducing old project or starting a new project using the most recent date | Current at that date, check `available_dates()` | Current at that date, check `available_dates()` | Current at that date, check `available_dates()` | Potentially outdated (up to 12 months) |
r_ver = "bleeding-edge" | To develop against the latest release of CRAN | Always current | Always current | Always current | Always current |
r_ver = "frozen-edge" | To develop against the latest release of CRAN, but manually manage updates | Current at time of generation | Current at time of generation | Current at time of generation | Current at time of generation |
r_ver = "r-devel" | To develop/test against the development version of R | Development version | Always current | Always current | Always current |
r_ver = "r-devel-bioc-devel" | To develop/test against the development version of R and Bioconductor | Development version | Always current | Development version | Always current |
r_ver = "bioc-devel" | To develop/test against the development version of Bioconductor | Always current | Always current | Development version | Always current |