Created
April 21, 2024 17:23
-
-
Save philipp-baumann/82464be194f665694492ae8e8e7ac9ff to your computer and use it in GitHub Desktop.
Get nix environment with R and arrow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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