diff --git a/R/find_rev.R b/R/find_rev.R index dfefe1e7..3e784949 100644 --- a/R/find_rev.R +++ b/R/find_rev.R @@ -283,6 +283,16 @@ fetchpkgs <- function(git_pkgs, archive_pkgs){ #' version 2.2.1 release, then use the Nix revision closest to that date, by setting #' `r_ver = "3.1.0"`, which was the version of R current at the time. This #' ensures that Nix builds a completely coherent environment. +#' By default, the nix shell will be configured with `"en_US.UTF-8"` for the +#' relevant locale variables (`LANG`, `LC_ALL`, `LC_TIME`, `LC_MONETARY`, +#' `LC_PAPER`). This is done to ensure locale reproducibility by default +#' in Nix environments. If there are good reasons to not stick to the default, +#' you can set your preferred locale variables via +#' `options(rix.nix_locale_variables = list(LANG = "de_CH.UTF-8", <...>)` +#' and the aforementioned locale variable names. However, you should use +#' UTF-8 locales since we import the `glibcLocalesUtf8` set only, to not +#' download the full set of locales and thereby keep the size reasonably +#' small. #' @export rix <- function(r_ver = "latest", r_pkgs = NULL, @@ -456,7 +466,7 @@ tex_pkgs) # to add it. generate_system_pkgs <- function(system_pkgs){ sprintf('system_packages = builtins.attrValues { - inherit (pkgs) R glibcLocales %s; + inherit (pkgs) R glibcLocalesUtf8 %s; }; ', get_system_pkgs(system_pkgs)) diff --git a/dev/build_envs.Rmd b/dev/build_envs.Rmd index 526aacd0..12300850 100644 --- a/dev/build_envs.Rmd +++ b/dev/build_envs.Rmd @@ -367,6 +367,16 @@ you use another IDE, you can leave the "ide" argument blank: #' version 2.2.1 release, then use the Nix revision closest to that date, by setting #' `r_ver = "3.1.0"`, which was the version of R current at the time. This #' ensures that Nix builds a completely coherent environment. +#' By default, the nix shell will be configured with `"en_US.UTF-8"` for the +#' relevant locale variables (`LANG`, `LC_ALL`, `LC_TIME`, `LC_MONETARY`, +#' `LC_PAPER`). This is done to ensure locale reproducibility by default +#' in Nix environments. If there are good reasons to not stick to the default, +#' you can set your preferred locale variables via +#' `options(rix.nix_locale_variables = list(LANG = "de_CH.UTF-8", <...>)` +#' and the aforementioned locale variable names. However, you should use +#' UTF-8 locales since we import the `glibcLocalesUtf8` set only, to not +#' download the full set of locales and thereby keep the size reasonably +#' small. #' @export rix <- function(r_ver = "latest", r_pkgs = NULL, @@ -540,7 +550,7 @@ tex_pkgs) # to add it. generate_system_pkgs <- function(system_pkgs){ sprintf('system_packages = builtins.attrValues { - inherit (pkgs) R glibcLocales %s; + inherit (pkgs) R glibcLocalesUtf8 %s; }; ', get_system_pkgs(system_pkgs)) diff --git a/inst/extdata/default.nix b/inst/extdata/default.nix index ad2eb9ae..4abcebf5 100644 --- a/inst/extdata/default.nix +++ b/inst/extdata/default.nix @@ -29,7 +29,7 @@ let }; }) ]; system_packages = builtins.attrValues { - inherit (pkgs) R glibcLocales ; + inherit (pkgs) R glibcLocalesUtf8 ; }; in pkgs.mkShell { diff --git a/man/rix.Rd b/man/rix.Rd index 49425d15..c6e773a3 100644 --- a/man/rix.Rd +++ b/man/rix.Rd @@ -88,4 +88,14 @@ want to use an environment as it would have looked at the time of \code{{ggplot2 version 2.2.1 release, then use the Nix revision closest to that date, by setting \code{r_ver = "3.1.0"}, which was the version of R current at the time. This ensures that Nix builds a completely coherent environment. +By default, the nix shell will be configured with \code{"en_US.UTF-8"} for the +relevant locale variables (\code{LANG}, \code{LC_ALL}, \code{LC_TIME}, \code{LC_MONETARY}, +\code{LC_PAPER}). This is done to ensure locale reproducibility by default +in Nix environments. If there are good reasons to not stick to the default, +you can set your preferred locale variables via +\verb{options(rix.nix_locale_variables = list(LANG = "de_CH.UTF-8", <...>)} +and the aforementioned locale variable names. However, you should use +UTF-8 locales since we import the \code{glibcLocalesUtf8} set only, to not +download the full set of locales and thereby keep the size reasonably +small. }