Skip to content

Instantly share code, notes, and snippets.

@philipp-baumann
Created April 21, 2024 17:23
Show Gist options
  • Save philipp-baumann/82464be194f665694492ae8e8e7ac9ff to your computer and use it in GitHub Desktop.
Save philipp-baumann/82464be194f665694492ae8e8e7ac9ff to your computer and use it in GitHub Desktop.
Get nix environment with R and arrow
if (!require("rix")) {
if (!require("remotes") install.packages("remotes")
remotes::install_github("b-rodrigues/rix")
}
library("rix")
# make sure that only nix library paths in /nix/... are used to load R packages
rix_init()
# define `default.nix` in reproducible manner (will ping nixpkgs revision on GitHub)
rix(
r_ver = "latest",
r_pkgs = "arrow"
)
# check option 1); run arrow and R from Nix(pkgs) in a separate process shell,
# directly from system's R session
rix::with_nix(expr = function() arrow::arrow_info())
# check option 2)
nix_build() (or do `nix-build .` in the shell the project dir
# change to your system shell, launch nix-shell and use the Nix environment
nix-shell default.nix
# then prompt R
R
# in Nix-R session
arrow::arrow_info()
sessionInfo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment