From ac35c2ccc166fd99ecac394d093a2cc8a5e4f3d6 Mon Sep 17 00:00:00 2001 From: Philipp Baumann Date: Mon, 15 Jan 2024 21:14:09 +0100 Subject: [PATCH 1/3] - use `glibcLocales` instead of `glibcLocalesUtf8` for older revisions --- R/detect_os.R | 2 +- R/find_rev.R | 7 ++----- dev/build_envs.Rmd | 7 ++----- dev/get_os.Rmd | 2 +- man/rix.Rd | 5 +---- 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/R/detect_os.R b/R/detect_os.R index 98cfcccf..530f478d 100644 --- a/R/detect_os.R +++ b/R/detect_os.R @@ -24,7 +24,7 @@ detect_os <- function(){ generate_locale_archive <- function(os){ os <- detect_os() if (os == "Linux" || os == "Darwin") { - 'LOCALE_ARCHIVE = if pkgs.system == \"x86_64-linux\" then \"${pkgs.glibcLocalesUtf8}/lib/locale/locale-archive\" else \"\";' + 'LOCALE_ARCHIVE = if pkgs.system == \"x86_64-linux\" then \"${pkgs.glibcLocales}/lib/locale/locale-archive\" else \"\";' } else { stop("Operating System unsupported") } diff --git a/R/find_rev.R b/R/find_rev.R index c794fdee..a8cc844a 100644 --- a/R/find_rev.R +++ b/R/find_rev.R @@ -290,10 +290,7 @@ fetchpkgs <- function(git_pkgs, archive_pkgs){ #' 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. +#' and the aforementioned locale variable names. #' @export rix <- function(r_ver = "latest", r_pkgs = NULL, @@ -467,7 +464,7 @@ tex_pkgs) # to add it. generate_system_pkgs <- function(system_pkgs){ sprintf('system_packages = builtins.attrValues { - inherit (pkgs) R glibcLocalesUtf8 %s; + inherit (pkgs) R glibcLocales %s; }; ', get_system_pkgs(system_pkgs)) diff --git a/dev/build_envs.Rmd b/dev/build_envs.Rmd index f5e8c3ce..8daa4797 100644 --- a/dev/build_envs.Rmd +++ b/dev/build_envs.Rmd @@ -374,10 +374,7 @@ you use another IDE, you can leave the "ide" argument blank: #' 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. +#' and the aforementioned locale variable names. #' @export rix <- function(r_ver = "latest", r_pkgs = NULL, @@ -551,7 +548,7 @@ tex_pkgs) # to add it. generate_system_pkgs <- function(system_pkgs){ sprintf('system_packages = builtins.attrValues { - inherit (pkgs) R glibcLocalesUtf8 %s; + inherit (pkgs) R glibcLocales %s; }; ', get_system_pkgs(system_pkgs)) diff --git a/dev/get_os.Rmd b/dev/get_os.Rmd index 1ca46b83..c069f1f8 100644 --- a/dev/get_os.Rmd +++ b/dev/get_os.Rmd @@ -43,7 +43,7 @@ This function adds deals with locale on Linux (and WSL2): generate_locale_archive <- function(os){ os <- detect_os() if (os == "Linux" || os == "Darwin") { - 'LOCALE_ARCHIVE = if pkgs.system == \"x86_64-linux\" then \"${pkgs.glibcLocalesUtf8}/lib/locale/locale-archive\" else \"\";' + 'LOCALE_ARCHIVE = if pkgs.system == \"x86_64-linux\" then \"${pkgs.glibcLocales}/lib/locale/locale-archive\" else \"\";' } else { stop("Operating System unsupported") } diff --git a/man/rix.Rd b/man/rix.Rd index 342cc8ba..406ae3b0 100644 --- a/man/rix.Rd +++ b/man/rix.Rd @@ -95,8 +95,5 @@ reproducibility by default in Nix environments created with \code{rix()}. 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. +and the aforementioned locale variable names. } From 8566572e26e598ffbd9fb1e92910ef9c0b847686 Mon Sep 17 00:00:00 2001 From: Philipp Baumann Date: Tue, 16 Jan 2024 18:58:48 +0100 Subject: [PATCH 2/3] - update with `glibcLocales` patch --- R/find_rev.R | 2 +- dev/build_envs.Rmd | 2 +- inst/extdata/default.nix | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/R/find_rev.R b/R/find_rev.R index a8cc844a..1187f0d9 100644 --- a/R/find_rev.R +++ b/R/find_rev.R @@ -588,7 +588,7 @@ create_default_nix <- function(path = file.path("inst", "extdata", package_name = "rix", repo_url = "https://github.com/b-rodrigues/rix", branch_name = "master", - commit = "a7b1659a5676ba34dfb68009d1993fc53431a4e3" + commit = "22711ee98c0092e56c620122800ca8f30b773a65" ) ), ide = "other", diff --git a/dev/build_envs.Rmd b/dev/build_envs.Rmd index 8daa4797..177abe93 100644 --- a/dev/build_envs.Rmd +++ b/dev/build_envs.Rmd @@ -676,7 +676,7 @@ create_default_nix <- function(path = file.path("inst", "extdata", package_name = "rix", repo_url = "https://github.com/b-rodrigues/rix", branch_name = "master", - commit = "a7b1659a5676ba34dfb68009d1993fc53431a4e3" + commit = "22711ee98c0092e56c620122800ca8f30b773a65" ) ), ide = "other", diff --git a/inst/extdata/default.nix b/inst/extdata/default.nix index db830e4e..386786bf 100644 --- a/inst/extdata/default.nix +++ b/inst/extdata/default.nix @@ -1,39 +1,39 @@ -# This file was generated by the {rix} R package v0.4.1 on 2023-10-06 +# This file was generated by the {rix} R package v0.5.0 on 2024-01-16 # with following call: -# >rix(r_ver = "7131f3c223a2d799568e4b278380cd9dac2b8579", +# >rix(r_ver = "e0629618b4b419a47e2c8a3cab223e2a7f3a8f97", # > r_pkgs = NULL, # > system_pkgs = NULL, # > git_pkgs = list(list(package_name = "rix", # > repo_url = "https://github.com/b-rodrigues/rix", # > branch_name = "master", -# > commit = "a7b1659a5676ba34dfb68009d1993fc53431a4e3")), +# > commit = "22711ee98c0092e56c620122800ca8f30b773a65")), # > ide = "other", # > project_path = dirname(path), # > overwrite = TRUE, # > shell_hook = "R --vanilla") -# It uses nixpkgs' revision 7131f3c223a2d799568e4b278380cd9dac2b8579 for reproducibility purposes +# It uses nixpkgs' revision e0629618b4b419a47e2c8a3cab223e2a7f3a8f97 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/7131f3c223a2d799568e4b278380cd9dac2b8579.tar.gz") {}; + pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/e0629618b4b419a47e2c8a3cab223e2a7f3a8f97.tar.gz") {}; git_archive_pkgs = [(pkgs.rPackages.buildRPackage { name = "rix"; src = pkgs.fetchgit { url = "https://github.com/b-rodrigues/rix"; branchName = "master"; - rev = "a7b1659a5676ba34dfb68009d1993fc53431a4e3"; - sha256 = "sha256-Z30dTSJW5jZjkC1I7mpAzuQthY4imc84r0V2cSp4XwM="; + rev = "22711ee98c0092e56c620122800ca8f30b773a65"; + sha256 = "sha256-uCyvALQ7F6qHh8/c0VS7T+/svtGEMEg2f7/+sUinbMo="; }; propagatedBuildInputs = builtins.attrValues { - inherit (pkgs.rPackages) httr jsonlite sys; + inherit (pkgs.rPackages) codetools httr jsonlite sys; }; }) ]; system_packages = builtins.attrValues { - inherit (pkgs) R glibcLocalesUtf8 ; + inherit (pkgs) R glibcLocales ; }; in pkgs.mkShell { - LOCALE_ARCHIVE = if pkgs.system == "x86_64-linux" then "${pkgs.glibcLocalesUtf8}/lib/locale/locale-archive" else ""; + 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"; From 28706de31f814eab5ba603d022befc0261a02761 Mon Sep 17 00:00:00 2001 From: Philipp Baumann Date: Tue, 16 Jan 2024 19:07:08 +0100 Subject: [PATCH 3/3] Bump version to 0.5.1 --- DESCRIPTION | 2 +- NEWS.md | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index f62e515c..9f8a6c2b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: rix Title: Rix: Reproducible Environments With Nix -Version: 0.5.0 +Version: 0.5.1 Authors@R: c( person("Bruno", "Rodrigues", , "bruno@brodrigues.co", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-3211-3689")), diff --git a/NEWS.md b/NEWS.md index f4d086c5..1f816e17 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,15 @@ +# rix 0.5.1 (2024-01-16) + +## Bug fixes + +- `rix::rix()`: patch for nixpkgs revisions corresponding to R (`r_ver`) + <= 4.2.0; `nix-build` failed because attribute `glibcLocalesUtf8` was + not found. Fixed by importing `gibcLocales`. Thanks @motorlearner for + reporting. + + # rix 0.5.0 (2024-01-07) ## Features