Skip to content

Commit

Permalink
better message
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Rodrigues committed Jul 29, 2023
1 parent a39713a commit 935fb19
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Depends:
Imports:
httr,
jsonlite,
stats,
utils
Suggests:
knitr,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ importFrom(httr,GET)
importFrom(httr,content)
importFrom(httr,stop_for_status)
importFrom(jsonlite,fromJSON)
importFrom(stats,na.omit)
importFrom(utils,data)
11 changes: 7 additions & 4 deletions R/find_rev.R
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ fetchgits <- function(git_pkgs){
#' remove_base Remove base packages from `propagatedBuildInputs`
#' @param list_imports A list. A vector of R package names.
#' @return A list. A vector of R package names without base R packages.
#' @importFrom stats na.omit
#' @noRd
remove_base <- function(list_imports){

Expand Down Expand Up @@ -285,11 +286,12 @@ rix <- function(r_ver = "current",
r_packages <- paste(r_pkgs, collapse = ' ')
other_packages <- paste(other_pkgs, collapse = ' ')

nixTemplate <- "
nixFile <- "
# This file was generated by the {rix} R package on DATE
# It uses nixpkgs' revision RE_VERSION for reproducibility purposes
# It uses nixpkgs' revision NIX_REV for reproducibility purposes
# which will install R version RE_VERSION
# Report any issues to https://github.com/b-rodrigues/rix
{ pkgs ? import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/RE_VERSION.tar.gz\") {} }:
{ pkgs ? import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/NIX_REV.tar.gz\") {} }:
with pkgs;
Expand All @@ -316,7 +318,8 @@ USE_RSTUDIO};
];
}"

nixFile <- gsub('RE_VERSION', find_rev(r_ver) , nixTemplate)
nixFile <- gsub('NIX_REV', find_rev(r_ver) , nixFile)
nixFile <- gsub('RE_VERSION', r_ver , nixFile)
nixFile <- gsub('DATE', date(), nixFile)

nixFile <- gsub('USE_RSTUDIO',
Expand Down
1 change: 1 addition & 0 deletions dev/0-dev_history.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ fusen::fill_description(
fields = list(
Title = "Rix: Reproducible Environments with Nix",
Description = "Provides helper functions to create reproducible development environments using the Nix package manager.",
Version = "0.0.9",
`Authors@R` = c(
person("Bruno", "Rodrigues", email = "bruno@brodrigues.co", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-3211-3689"))
)
Expand Down
11 changes: 7 additions & 4 deletions dev/build_envs.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ to build a package from Github that will list its `IMPORTS` under
#' remove_base Remove base packages from `propagatedBuildInputs`
#' @param list_imports A list. A vector of R package names.
#' @return A list. A vector of R package names without base R packages.
#' @importFrom stats na.omit
remove_base <- function(list_imports){
gsub("(base)|(compiler)|(datasets)|(grDevices)|(graphics)|(grid)|(methods)|(parallel)|(profile)|(splines)|(stats)|(stats4)|(tcltk)|(tools)|(translations)|(utils)",
Expand Down Expand Up @@ -399,11 +400,12 @@ rix <- function(r_ver = "current",
r_packages <- paste(r_pkgs, collapse = ' ')
other_packages <- paste(other_pkgs, collapse = ' ')
nixTemplate <- "
nixFile <- "
# This file was generated by the {rix} R package on DATE
# It uses nixpkgs' revision RE_VERSION for reproducibility purposes
# It uses nixpkgs' revision NIX_REV for reproducibility purposes
# which will install R version RE_VERSION
# Report any issues to https://github.com/b-rodrigues/rix
{ pkgs ? import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/RE_VERSION.tar.gz\") {} }:
{ pkgs ? import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/NIX_REV.tar.gz\") {} }:
with pkgs;
Expand All @@ -430,7 +432,8 @@ USE_RSTUDIO};
];
}"
nixFile <- gsub('RE_VERSION', find_rev(r_ver) , nixTemplate)
nixFile <- gsub('NIX_REV', find_rev(r_ver) , nixFile)
nixFile <- gsub('RE_VERSION', r_ver , nixFile)
nixFile <- gsub('DATE', date(), nixFile)
nixFile <- gsub('USE_RSTUDIO',
Expand Down

0 comments on commit 935fb19

Please sign in to comment.