diff --git a/.Rprofile b/.Rprofile index e6cbf69..6a0f49a 100644 --- a/.Rprofile +++ b/.Rprofile @@ -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" @@ -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) } diff --git a/default.nix b/default.nix index 408f1e9..c63dd4c 100644 --- a/default.nix +++ b/default.nix @@ -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", @@ -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 ]; + + } diff --git a/plots/plot.png b/plots/plot.png deleted file mode 100644 index dde2ad1..0000000 Binary files a/plots/plot.png and /dev/null differ diff --git a/result b/result new file mode 120000 index 0000000..6b42e47 --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/qq82s0zks1yxq4dwdmylcy182m9r35jf-nix-shell \ No newline at end of file