Skip to content

Commit

Permalink
Testing rix patch
Browse files Browse the repository at this point in the history
  • Loading branch information
brancengregory committed Jun 9, 2024
1 parent ac4ee20 commit 8d6f9be
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 26 deletions.
10 changes: 5 additions & 5 deletions .Rprofile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# at run-time.
{
is_rstudio <- Sys.getenv("RSTUDIO") == "1"
is_nixr <- nzchar(Sys.getenv("NIX_STORE"))
if (isFALSE(is_nixr) && isTRUE(is_rstudio)) {
is_nix_r <- nzchar(Sys.getenv("NIX_STORE"))
if (isFALSE(is_nix_r) && isTRUE(is_rstudio)) {
cat("{rix} detected RStudio R session")
old_path <- Sys.getenv("PATH")
nix_path <- "/nix/var/nix/profiles/default/bin"
Expand All @@ -20,13 +20,13 @@
}
rm(old_path, nix_path)
}
if (isTRUE(is_nixr)) {
if (isTRUE(is_nix_r)) {
current_paths <- .libPaths()
userlib_paths <- Sys.getenv("R_LIBS_USER")
user_dir <- grep(paste(userlib_paths, collapse = "|"), current_paths)
user_dir <- grep(paste(userlib_paths, collapse = "|"), current_paths, fixed = TRUE)
new_paths <- current_paths[-user_dir]
.libPaths(new_paths)
rm(current_paths, userlib_paths, user_dir, new_paths)
}
rm(is_rstudio, is_nixr)
rm(is_rstudio, is_nix_r)
}
51 changes: 30 additions & 21 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was generated by the {rix} R package v0.7.0 on 2024-05-24
# This file was generated by the {rix} R package v0.7.1 on 2024-06-09
# with following call:
# >rix(r_ver = "https://github.com/NixOS/nixpkgs/archive/3305b2b25e4ae4baee872346eae133cf6f611783.tar.gz",
# >rix(r_ver = "cd18e2ae9ab8e2a0a8d715b60c91b54c0ac35ff9",
# > r_pkgs = c("targets",
# > "dplyr",
# > "ggplot2",
Expand All @@ -11,27 +11,36 @@
# > project_path = ".",
# > overwrite = TRUE,
# > print = TRUE)
# It uses nixpkgs' revision 3305b2b25e4ae4baee872346eae133cf6f611783 for reproducibility purposes
# which will install R version latest
# It uses nixpkgs' revision cd18e2ae9ab8e2a0a8d715b60c91b54c0ac35ff9 for reproducibility purposes
# which will install R version latest.
# Report any issues to https://github.com/b-rodrigues/rix
let
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/3305b2b25e4ae4baee872346eae133cf6f611783.tar.gz") {};
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/cd18e2ae9ab8e2a0a8d715b60c91b54c0ac35ff9.tar.gz") {};

rpkgs = builtins.attrValues {
inherit (pkgs.rPackages) targets dplyr ggplot2 readr here;
};
system_packages = builtins.attrValues {
inherit (pkgs.rPackages)
targets
dplyr
ggplot2
readr
here;
};

system_packages = builtins.attrValues {
inherit (pkgs) R glibcLocales nix;
};
in
pkgs.mkShell {
LOCALE_ARCHIVE = if pkgs.system == "x86_64-linux" then "${pkgs.glibcLocales}/lib/locale/locale-archive" else "";
LANG = "en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
};

in

buildInputs = [ rpkgs system_packages ];

}
pkgs.mkShell {
LOCALE_ARCHIVE = if pkgs.system == "x86_64-linux" then "${pkgs.glibcLocales}/lib/locale/locale-archive" else "";
LANG = "en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";

buildInputs = [ rpkgs system_packages ];

}
Binary file removed plots/plot.png
Binary file not shown.
1 change: 1 addition & 0 deletions result

0 comments on commit 8d6f9be

Please sign in to comment.