## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----include=FALSE------------------------------------------------------------
library(rix)

## ----eval = F-----------------------------------------------------------------
# path_default_nix <- tempdir()
# 
# rix(
#   r_ver = "4.2.1",
#   r_pkgs = c("dplyr@0.8.0", "janitor@1.0.0"),
#   system_pkgs = NULL,
#   git_pkgs = NULL,
#   ide = "none",
#   project_path = path_default_nix,
#   overwrite = TRUE
# )

## ----eval = F-----------------------------------------------------------------
# path_default_nix <- tempdir()
# 
# rix(
#   r_ver = "4.2.1",
#   r_pkgs = c("dplyr", "janitor"),
#   git_pkgs = list(
#     list(
#       package_name = "housing",
#       repo_url = "https://github.com/rap4all/housing/",
#       commit = "1c860959310b80e67c41f7bbdc3e84cef00df18e"
#     ),
#     list(
#       package_name = "fusen",
#       repo_url = "https://github.com/ThinkR-open/fusen",
#       commit = "d617172447d2947efb20ad6a4463742b8a5d79dc"
#     )
#   ),
#   ide = "none",
#   project_path = path_default_nix,
#   overwrite = TRUE
# )

## ----parsermd-chunk-4, echo = F-----------------------------------------------
#> # This file was generated by the {rix} R package v0.7.1 on 2024-07-01
#> # with following call:
#> # >rix(r_ver = "79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a",
#> #  > r_pkgs = c("dplyr",
#> #  > "janitor"),
#> #  > git_pkgs = list(list(package_name = "housing",
#> #  > repo_url = "https://github.com/rap4all/housing/",
#> #  > commit = "1c860959310b80e67c41f7bbdc3e84cef00df18e"),
#> #  > list(package_name = "fusen",
#> #  > repo_url = "https://github.com/ThinkR-open/fusen",
#> #  > commit = "d617172447d2947efb20ad6a4463742b8a5d79dc")),
#> #  > ide = "none",
#> #  > project_path = path_default_nix,
#> #  > overwrite = TRUE)
#> # It uses nixpkgs' revision 79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a for reproducibility purposes
#> # which will install R version 4.2.1.
#> # Report any issues to https://github.com/ropensci/rix
#> let
#>  pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a.tar.gz") {};
#>
#>   rpkgs = builtins.attrValues {
#>     inherit (pkgs.rPackages)
#>       dplyr
#>       janitor;
#>   };
#>
#>   git_archive_pkgs = [
#>     (pkgs.rPackages.buildRPackage {
#>       name = "housing";
#>       src = pkgs.fetchgit {
#>         url = "https://github.com/rap4all/housing/";
#>         rev = "1c860959310b80e67c41f7bbdc3e84cef00df18e";
#>         sha256 = "sha256-s4KGtfKQ7hL0sfDhGb4BpBpspfefBN6hf+XlslqyEn4=";
#>       };
#>       propagatedBuildInputs = builtins.attrValues {
#>         inherit (pkgs.rPackages)
#>           dplyr
#>           ggplot2
#>           janitor
#>           purrr
#>           readxl
#>           rlang
#>           rvest
#>           stringr
#>           tidyr;
#>       };
#>     })
#>
#>
#>     (pkgs.rPackages.buildRPackage {
#>       name = "fusen";
#>       src = pkgs.fetchgit {
#>         url = "https://github.com/ThinkR-open/fusen";
#>         rev = "d617172447d2947efb20ad6a4463742b8a5d79dc";
#>         sha256 = "sha256-TOHA1ymLUSgZMYIA1a2yvuv0799svaDOl3zOhNRxcmw=";
#>       };
#>       propagatedBuildInputs = builtins.attrValues {
#>         inherit (pkgs.rPackages)
#>           attachment
#>           cli
#>           desc
#>           devtools
#>           glue
#>           here
#>           magrittr
#>           parsermd
#>           roxygen2
#>           stringi
#>           tibble
#>           tidyr
#>           usethis
#>           yaml;
#>       };
#>     })
#>    ];
#>
#>   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";
#>
#>   buildInputs = [ git_archive_pkgs rpkgs  system_packages   ];
#>
#> }

## ----eval = F-----------------------------------------------------------------
# path_default_nix <- tempdir()
# 
# rix(
#   r_ver = "4.5.0",
#   r_pkgs = c("dplyr"),
#   system_pkgs = NULL,
#   git_pkgs = list(
#     package_name = "BPCells",
#     repo_url = "https://github.com/bnprks/BPCells/r",
#     commit = "16faeade0a26b392637217b0caf5d7017c5bdf9b"
#   ),
#   ide = "none",
#   project_path = ".",
#   overwrite = TRUE,
#   print = TRUE
# )

## ----eval = F-----------------------------------------------------------------
# rix(
#   r_ver = "4.3.1",
#   local_r_pkgs = c("chronicler_0.2.1.tar.gz", "knitr_1.43.tar.gz"),
#   overwrite = TRUE
# )

## ----eval = F-----------------------------------------------------------------
# rix(
#   r_ver = "4.4.1",
#   git_pkgs = list(
#     package_name = "myPrivatePkg",
#     repo_url = "git@github.com:myorg/private-repo.git",
#     commit = "abc123def456",
#     private = TRUE
#   ),
#   overwrite = TRUE
# )

## ----eval = F-----------------------------------------------------------------
# rix(
#   date = "2025-02-17",
#   r_pkgs = "ggplot2",
#   py_conf = list(
#     py_version = "3.12",
#     py_pkgs = c("polars", "great-tables")
#   ),
#   overwrite = TRUE
# )

## ----eval = F-----------------------------------------------------------------
# rix(
#   ...
#   system_pkgs = c("uv"),
#   ...
# )

## ----eval = F-----------------------------------------------------------------
# rix(
#   date = "2025-09-04",
#   r_pkgs = "ggplot2",
#   jl_conf = list(
#     jl_version = "1.11",
#     jl_pkgs = c("TidierData", "GLM")
#   ),
#   project_path = ".",
#   overwrite = TRUE
# )

## ----eval = F-----------------------------------------------------------------
# path_default_nix <- tempdir()
# 
# rix(
#   r_ver = "4.2.1",
#   r_pkgs = c("dplyr", "janitor", "AER@1.2-8"),
#   git_pkgs = list(
#     list(
#       package_name = "housing",
#       repo_url = "https://github.com/rap4all/housing/",
#       commit = "1c860959310b80e67c41f7bbdc3e84cef00df18e"
#     ),
#     list(
#       package_name = "fusen",
#       repo_url = "https://github.com/ThinkR-open/fusen",
#       commit = "d617172447d2947efb20ad6a4463742b8a5d79dc"
#     )
#   ),
#   ide = "none",
#   project_path = path_default_nix,
#   overwrite = TRUE
# )

