diff --git a/articles/b2-setting-up-and-using-rix-on-macos.html b/articles/b2-setting-up-and-using-rix-on-macos.html index bf856ce1..0160568a 100644 --- a/articles/b2-setting-up-and-using-rix-on-macos.html +++ b/articles/b2-setting-up-and-using-rix-on-macos.html @@ -113,7 +113,7 @@

Introduction @@ -183,6 +183,16 @@

Generating expressionsMore macOS specificities

+

R Support for Apple Silicon in Nixpkgs +

+

In Nixpkgs, the M series processors of the ARM64 family, also known +under AArch64, supports R since R version 3.5.3. Earlier versions of R +will not compile on modern Apple processor architectures for the +corresponding Nixpkgs revisions at that time. Hence, the +darwin-aarch64 platform has constrained +backwards-compatibility.

+
+

Shared libraries issue

When using environments built with Nix on macOS, you might get diff --git a/articles/c-using-rix-to-build-project-specific-environments.html b/articles/c-using-rix-to-build-project-specific-environments.html index 3527affc..5ed3309e 100644 --- a/articles/c-using-rix-to-build-project-specific-environments.html +++ b/articles/c-using-rix-to-build-project-specific-environments.html @@ -159,9 +159,9 @@

Project-specific Nix environments project_path = path_default_nix, overwrite = TRUE, print = TRUE) -#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 +#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: -#> # >rix(r_ver = "9a9a7552431c4f1a3b2eee9398641babf7c30d0e", +#> # >rix(r_ver = "4008381882569ab4773f2ba0d7b7bbde8f665672", #> # > r_pkgs = c("dplyr", #> # > "ggplot2"), #> # > system_pkgs = NULL, @@ -170,11 +170,11 @@

Project-specific Nix environments#> # > project_path = path_default_nix, #> # > overwrite = TRUE, #> # > print = TRUE) -#> # It uses nixpkgs' revision 9a9a7552431c4f1a3b2eee9398641babf7c30d0e for reproducibility purposes +#> # It uses nixpkgs' revision 4008381882569ab4773f2ba0d7b7bbde8f665672 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/9a9a7552431c4f1a3b2eee9398641babf7c30d0e.tar.gz") {}; +#> pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/4008381882569ab4773f2ba0d7b7bbde8f665672.tar.gz") {}; #> rpkgs = builtins.attrValues { #> inherit (pkgs.rPackages) dplyr ggplot2 languageserver; #> }; @@ -235,7 +235,7 @@

Running old projects with {rix}= path_default_nix, overwrite = TRUE)

The file looks like this:

-
#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12
+
#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13
 #> # with following call:
 #> # >rix(r_ver = "79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a",
 #> #  > r_pkgs = c("dplyr",
diff --git a/articles/d1-installing-r-packages-in-a-nix-environment.html b/articles/d1-installing-r-packages-in-a-nix-environment.html
index 14023336..339192ac 100644
--- a/articles/d1-installing-r-packages-in-a-nix-environment.html
+++ b/articles/d1-installing-r-packages-in-a-nix-environment.html
@@ -125,7 +125,7 @@ 

Installing old packages archiv ide = "other", project_path = path_default_nix, overwrite = TRUE)

-
#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12
+
#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13
 #> # with following call:
 #> # >rix(r_ver = "79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a",
 #> #  > r_pkgs = c("dplyr@0.8.0",
@@ -206,7 +206,7 @@ 

Installing packages from Github ide = "other", project_path = path_default_nix, overwrite = TRUE)

-
#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12
+
#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13
 #> # with following call:
 #> # >rix(r_ver = "79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a",
 #> #  > r_pkgs = c("dplyr",
@@ -298,7 +298,7 @@ 

A complete example= "other", project_path = path_default_nix, overwrite = TRUE)

-
#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12
+
#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13
 #> # with following call:
 #> # >rix(r_ver = "79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a",
 #> #  > r_pkgs = c("dplyr",
diff --git a/articles/d2-installing-system-tools-and-texlive-packages-in-a-nix-environment.html b/articles/d2-installing-system-tools-and-texlive-packages-in-a-nix-environment.html
index b3a7258c..8b56d931 100644
--- a/articles/d2-installing-system-tools-and-texlive-packages-in-a-nix-environment.html
+++ b/articles/d2-installing-system-tools-and-texlive-packages-in-a-nix-environment.html
@@ -144,9 +144,9 @@ 

Adding tools to an environment= "other", project_path = path_default_nix, overwrite = TRUE)

-
#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12
+
#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13
 #> # with following call:
-#> # >rix(r_ver = "9a9a7552431c4f1a3b2eee9398641babf7c30d0e",
+#> # >rix(r_ver = "4008381882569ab4773f2ba0d7b7bbde8f665672",
 #> #  > r_pkgs = c("quarto"),
 #> #  > system_pkgs = c("quarto",
 #> #  > "git"),
@@ -154,11 +154,11 @@ 

Adding tools to an environment#> # > ide = "other", #> # > project_path = path_default_nix, #> # > overwrite = TRUE) -#> # It uses nixpkgs' revision 9a9a7552431c4f1a3b2eee9398641babf7c30d0e for reproducibility purposes +#> # It uses nixpkgs' revision 4008381882569ab4773f2ba0d7b7bbde8f665672 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/9a9a7552431c4f1a3b2eee9398641babf7c30d0e.tar.gz") {}; +#> pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/4008381882569ab4773f2ba0d7b7bbde8f665672.tar.gz") {}; #> rpkgs = builtins.attrValues { #> inherit (pkgs.rPackages) quarto; #> }; @@ -204,9 +204,9 @@

Installing TexLive packages= path_default_nix, overwrite = TRUE, print = TRUE) -#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 +#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: -#> # >rix(r_ver = "9a9a7552431c4f1a3b2eee9398641babf7c30d0e", +#> # >rix(r_ver = "4008381882569ab4773f2ba0d7b7bbde8f665672", #> # > r_pkgs = c("quarto"), #> # > system_pkgs = "quarto", #> # > tex_pkgs = c("amsmath"), @@ -214,11 +214,11 @@

Installing TexLive packages#> # > project_path = path_default_nix, #> # > overwrite = TRUE, #> # > print = TRUE) -#> # It uses nixpkgs' revision 9a9a7552431c4f1a3b2eee9398641babf7c30d0e for reproducibility purposes +#> # It uses nixpkgs' revision 4008381882569ab4773f2ba0d7b7bbde8f665672 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/9a9a7552431c4f1a3b2eee9398641babf7c30d0e.tar.gz") {}; +#> pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/4008381882569ab4773f2ba0d7b7bbde8f665672.tar.gz") {}; #> rpkgs = builtins.attrValues { #> inherit (pkgs.rPackages) quarto; #> }; diff --git a/articles/z-advanced-topic-building-an-environment-for-literate-programming.html b/articles/z-advanced-topic-building-an-environment-for-literate-programming.html index dda0efe8..066abc0a 100644 --- a/articles/z-advanced-topic-building-an-environment-for-literate-programming.html +++ b/articles/z-advanced-topic-building-an-environment-for-literate-programming.html @@ -141,7 +141,7 @@

Starting project_path = path_default_nix, overwrite = TRUE, print = TRUE) -#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 +#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = "976fa3369d722e76f37c77493d99829540d43845", #> # > r_pkgs = c("quarto"), @@ -226,7 +226,7 @@

Starting project_path = path_default_nix, overwrite = TRUE, print = TRUE) -#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 +#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = "976fa3369d722e76f37c77493d99829540d43845", #> # > r_pkgs = c("quarto", @@ -299,7 +299,7 @@

Starting project_path = path_default_nix, overwrite = TRUE, print = TRUE) -#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 +#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = "976fa3369d722e76f37c77493d99829540d43845", #> # > r_pkgs = c("quarto", diff --git a/articles/z-advanced-topic-handling-packages-with-remote-dependencies.html b/articles/z-advanced-topic-handling-packages-with-remote-dependencies.html index a7802cdf..1d4e5682 100644 --- a/articles/z-advanced-topic-handling-packages-with-remote-dependencies.html +++ b/articles/z-advanced-topic-handling-packages-with-remote-dependencies.html @@ -142,9 +142,9 @@

The {lookup} package= path_default_nix, overwrite = TRUE, print = TRUE) -#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 +#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: -#> # >rix(r_ver = "9a9a7552431c4f1a3b2eee9398641babf7c30d0e", +#> # >rix(r_ver = "4008381882569ab4773f2ba0d7b7bbde8f665672", #> # > r_pkgs = NULL, #> # > system_pkgs = NULL, #> # > git_pkgs = list(package_name = "lookup", @@ -155,11 +155,11 @@

The {lookup} package#> # > project_path = path_default_nix, #> # > overwrite = TRUE, #> # > print = TRUE) -#> # It uses nixpkgs' revision 9a9a7552431c4f1a3b2eee9398641babf7c30d0e for reproducibility purposes +#> # It uses nixpkgs' revision 4008381882569ab4773f2ba0d7b7bbde8f665672 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/9a9a7552431c4f1a3b2eee9398641babf7c30d0e.tar.gz") {}; +#> pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/4008381882569ab4773f2ba0d7b7bbde8f665672.tar.gz") {}; #> git_archive_pkgs = [(pkgs.rPackages.buildRPackage { #> name = "lookup"; #> src = pkgs.fetchgit { diff --git a/articles/z-advanced-topic-reproducible-analytical-pipelines-with-nix.html b/articles/z-advanced-topic-reproducible-analytical-pipelines-with-nix.html index eec43ae8..ce90f244 100644 --- a/articles/z-advanced-topic-reproducible-analytical-pipelines-with-nix.html +++ b/articles/z-advanced-topic-reproducible-analytical-pipelines-with-nix.html @@ -132,7 +132,7 @@

An example o overwrite = TRUE)

This call to rix() generates the following default.nix file:

-
#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12
+
#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13
 #> # with following call:
 #> # >rix(r_ver = "8ad5e8132c5dcf977e308e7bf5517cc6cc0bf7d8",
 #> #  > r_pkgs = c("targets",
diff --git a/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html b/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html
index 691d8d5d..d8cb2041 100644
--- a/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html
+++ b/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html
@@ -260,7 +260,7 @@ 

Setting up the (R) softw )

The following expression is written to default.nix in the subfolder ./_env_1_R-4-1-3/.

-
#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12
+
#> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13
 #> # with following call:
 #> # >rix(r_ver = "6e3a86f2f73a466656a401302d3ece26fba401d9",
 #> #  > project_path = path_env_1,
@@ -496,13 +496,13 @@ 

There was a change introduce in {stringr} 1.5.0; in earlier versions, this line of code:

-stringr::str_subset(c("", "a"), "")
+stringr::str_subset(c("", "a"), "")

would return the character "a". However, this behaviour is unexpected: it really should return an error. This was addressed in versions after 1.5.0:

 out_system_stringr <- tryCatch(
-  expr = {stringr::str_subset(c("", "a"), "")},
+  expr = {stringr::str_subset(c("", "a"), "")},
   error = function(e)NULL)

Since the code returns an error, we wrap it inside tryCatch() and return NULL instead of an error @@ -547,7 +547,7 @@

We can now run the code in the subshell

 out_nix_stringr <- with_nix(
-  expr = function() stringr::str_subset(c("", "a"), ""),
+  expr = function() stringr::str_subset(c("", "a"), ""),
   program = "R",
   exec_mode = "non-blocking",
   project_path = path_env_stringr,
diff --git a/pkgdown.yml b/pkgdown.yml
index 86947459..f1bdacca 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -15,7 +15,7 @@ articles:
   z-advanced-topic-running-r-or-shell-code-in-nix-from-r: z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html
   z-developers-vignette-generate-an-environment-with-rix-only: z-developers-vignette-generate-an-environment-with-rix-only.html
   z-developers-vignette-save-the-nix-package-versions-data: z-developers-vignette-save-the-nix-package-versions-data.html
-last_built: 2024-03-12T15:09Z
+last_built: 2024-03-13T15:44Z
 urls:
   reference: https://b-rodrigues.github.io/rix/reference
   article: https://b-rodrigues.github.io/rix/articles
diff --git a/search.json b/search.json
index a585d87c..0f3ff27d 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":"https://b-rodrigues.github.io/rix/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing","title":"Contributing","text":"package developed using fusen package. want contribute, please edit .Rmd files found dev/ folder. , inflate package using fusen::inflate_all(). errors found (warning notes OK), commit open PR. learn use fusen (don’t worry, ’s super easy), refer vignette. development workflow, use semantic versioning via {fledge}.","code":""},{"path":"https://b-rodrigues.github.io/rix/CONTRIBUTING.html","id":"discussions","dir":"","previous_headings":"","what":"Discussions","title":"Contributing","text":"general discussion package, open discussion https://github.com/b-rodrigues/rix/discussions. submit bug reports request features, open issue https://github.com/b-rodrigues/issues.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"GNU General Public License","title":"GNU General Public License","text":"Version 3, 29 June 2007Copyright © 2007 Free Software Foundation, Inc.  Everyone permitted copy distribute verbatim copies license document, changing allowed.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"preamble","dir":"","previous_headings":"","what":"Preamble","title":"GNU General Public License","text":"GNU General Public License free, copyleft license software kinds works. licenses software practical works designed take away freedom share change works. contrast, GNU General Public License intended guarantee freedom share change versions program–make sure remains free software users. , Free Software Foundation, use GNU General Public License software; applies also work released way authors. can apply programs, . speak free software, referring freedom, price. General Public Licenses designed make sure freedom distribute copies free software (charge wish), receive source code can get want , can change software use pieces new free programs, know can things. protect rights, need prevent others denying rights asking surrender rights. Therefore, certain responsibilities distribute copies software, modify : responsibilities respect freedom others. example, distribute copies program, whether gratis fee, must pass recipients freedoms received. must make sure , , receive can get source code. must show terms know rights. Developers use GNU GPL protect rights two steps: (1) assert copyright software, (2) offer License giving legal permission copy, distribute /modify . developers’ authors’ protection, GPL clearly explains warranty free software. users’ authors’ sake, GPL requires modified versions marked changed, problems attributed erroneously authors previous versions. devices designed deny users access install run modified versions software inside , although manufacturer can . fundamentally incompatible aim protecting users’ freedom change software. systematic pattern abuse occurs area products individuals use, precisely unacceptable. Therefore, designed version GPL prohibit practice products. problems arise substantially domains, stand ready extend provision domains future versions GPL, needed protect freedom users. Finally, every program threatened constantly software patents. States allow patents restrict development use software general-purpose computers, , wish avoid special danger patents applied free program make effectively proprietary. prevent , GPL assures patents used render program non-free. precise terms conditions copying, distribution modification follow.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_0-definitions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"0. Definitions","title":"GNU General Public License","text":"“License” refers version 3 GNU General Public License. “Copyright” also means copyright-like laws apply kinds works, semiconductor masks. “Program” refers copyrightable work licensed License. licensee addressed “”. “Licensees” “recipients” may individuals organizations. “modify” work means copy adapt part work fashion requiring copyright permission, making exact copy. resulting work called “modified version” earlier work work “based ” earlier work. “covered work” means either unmodified Program work based Program. “propagate” work means anything , without permission, make directly secondarily liable infringement applicable copyright law, except executing computer modifying private copy. Propagation includes copying, distribution (without modification), making available public, countries activities well. “convey” work means kind propagation enables parties make receive copies. Mere interaction user computer network, transfer copy, conveying. interactive user interface displays “Appropriate Legal Notices” extent includes convenient prominently visible feature (1) displays appropriate copyright notice, (2) tells user warranty work (except extent warranties provided), licensees may convey work License, view copy License. interface presents list user commands options, menu, prominent item list meets criterion.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_1-source-code","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"1. Source Code","title":"GNU General Public License","text":"“source code” work means preferred form work making modifications . “Object code” means non-source form work. “Standard Interface” means interface either official standard defined recognized standards body, , case interfaces specified particular programming language, one widely used among developers working language. “System Libraries” executable work include anything, work whole, () included normal form packaging Major Component, part Major Component, (b) serves enable use work Major Component, implement Standard Interface implementation available public source code form. “Major Component”, context, means major essential component (kernel, window system, ) specific operating system () executable work runs, compiler used produce work, object code interpreter used run . “Corresponding Source” work object code form means source code needed generate, install, (executable work) run object code modify work, including scripts control activities. However, include work’s System Libraries, general-purpose tools generally available free programs used unmodified performing activities part work. example, Corresponding Source includes interface definition files associated source files work, source code shared libraries dynamically linked subprograms work specifically designed require, intimate data communication control flow subprograms parts work. Corresponding Source need include anything users can regenerate automatically parts Corresponding Source. Corresponding Source work source code form work.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_2-basic-permissions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"2. Basic Permissions","title":"GNU General Public License","text":"rights granted License granted term copyright Program, irrevocable provided stated conditions met. License explicitly affirms unlimited permission run unmodified Program. output running covered work covered License output, given content, constitutes covered work. License acknowledges rights fair use equivalent, provided copyright law. may make, run propagate covered works convey, without conditions long license otherwise remains force. may convey covered works others sole purpose make modifications exclusively , provide facilities running works, provided comply terms License conveying material control copyright. thus making running covered works must exclusively behalf, direction control, terms prohibit making copies copyrighted material outside relationship . Conveying circumstances permitted solely conditions stated . Sublicensing allowed; section 10 makes unnecessary.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_3-protecting-users-legal-rights-from-anti-circumvention-law","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"3. Protecting Users’ Legal Rights From Anti-Circumvention Law","title":"GNU General Public License","text":"covered work shall deemed part effective technological measure applicable law fulfilling obligations article 11 WIPO copyright treaty adopted 20 December 1996, similar laws prohibiting restricting circumvention measures. convey covered work, waive legal power forbid circumvention technological measures extent circumvention effected exercising rights License respect covered work, disclaim intention limit operation modification work means enforcing, work’s users, third parties’ legal rights forbid circumvention technological measures.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_4-conveying-verbatim-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"4. Conveying Verbatim Copies","title":"GNU General Public License","text":"may convey verbatim copies Program’s source code receive , medium, provided conspicuously appropriately publish copy appropriate copyright notice; keep intact notices stating License non-permissive terms added accord section 7 apply code; keep intact notices absence warranty; give recipients copy License along Program. may charge price price copy convey, may offer support warranty protection fee.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_5-conveying-modified-source-versions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"5. Conveying Modified Source Versions","title":"GNU General Public License","text":"may convey work based Program, modifications produce Program, form source code terms section 4, provided also meet conditions: ) work must carry prominent notices stating modified , giving relevant date. b) work must carry prominent notices stating released License conditions added section 7. requirement modifies requirement section 4 “keep intact notices”. c) must license entire work, whole, License anyone comes possession copy. License therefore apply, along applicable section 7 additional terms, whole work, parts, regardless packaged. License gives permission license work way, invalidate permission separately received . d) work interactive user interfaces, must display Appropriate Legal Notices; however, Program interactive interfaces display Appropriate Legal Notices, work need make . compilation covered work separate independent works, nature extensions covered work, combined form larger program, volume storage distribution medium, called “aggregate” compilation resulting copyright used limit access legal rights compilation’s users beyond individual works permit. Inclusion covered work aggregate cause License apply parts aggregate.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_6-conveying-non-source-forms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"6. Conveying Non-Source Forms","title":"GNU General Public License","text":"may convey covered work object code form terms sections 4 5, provided also convey machine-readable Corresponding Source terms License, one ways: ) Convey object code , embodied , physical product (including physical distribution medium), accompanied Corresponding Source fixed durable physical medium customarily used software interchange. b) Convey object code , embodied , physical product (including physical distribution medium), accompanied written offer, valid least three years valid long offer spare parts customer support product model, give anyone possesses object code either (1) copy Corresponding Source software product covered License, durable physical medium customarily used software interchange, price reasonable cost physically performing conveying source, (2) access copy Corresponding Source network server charge. c) Convey individual copies object code copy written offer provide Corresponding Source. alternative allowed occasionally noncommercially, received object code offer, accord subsection 6b. d) Convey object code offering access designated place (gratis charge), offer equivalent access Corresponding Source way place charge. need require recipients copy Corresponding Source along object code. place copy object code network server, Corresponding Source may different server (operated third party) supports equivalent copying facilities, provided maintain clear directions next object code saying find Corresponding Source. Regardless server hosts Corresponding Source, remain obligated ensure available long needed satisfy requirements. e) Convey object code using peer--peer transmission, provided inform peers object code Corresponding Source work offered general public charge subsection 6d. separable portion object code, whose source code excluded Corresponding Source System Library, need included conveying object code work. “User Product” either (1) “consumer product”, means tangible personal property normally used personal, family, household purposes, (2) anything designed sold incorporation dwelling. determining whether product consumer product, doubtful cases shall resolved favor coverage. particular product received particular user, “normally used” refers typical common use class product, regardless status particular user way particular user actually uses, expects expected use, product. product consumer product regardless whether product substantial commercial, industrial non-consumer uses, unless uses represent significant mode use product. “Installation Information” User Product means methods, procedures, authorization keys, information required install execute modified versions covered work User Product modified version Corresponding Source. information must suffice ensure continued functioning modified object code case prevented interfered solely modification made. convey object code work section , , specifically use , User Product, conveying occurs part transaction right possession use User Product transferred recipient perpetuity fixed term (regardless transaction characterized), Corresponding Source conveyed section must accompanied Installation Information. requirement apply neither third party retains ability install modified object code User Product (example, work installed ROM). requirement provide Installation Information include requirement continue provide support service, warranty, updates work modified installed recipient, User Product modified installed. Access network may denied modification materially adversely affects operation network violates rules protocols communication across network. Corresponding Source conveyed, Installation Information provided, accord section must format publicly documented (implementation available public source code form), must require special password key unpacking, reading copying.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_7-additional-terms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"7. Additional Terms","title":"GNU General Public License","text":"“Additional permissions” terms supplement terms License making exceptions one conditions. Additional permissions applicable entire Program shall treated though included License, extent valid applicable law. additional permissions apply part Program, part may used separately permissions, entire Program remains governed License without regard additional permissions. convey copy covered work, may option remove additional permissions copy, part . (Additional permissions may written require removal certain cases modify work.) may place additional permissions material, added covered work, can give appropriate copyright permission. Notwithstanding provision License, material add covered work, may (authorized copyright holders material) supplement terms License terms: ) Disclaiming warranty limiting liability differently terms sections 15 16 License; b) Requiring preservation specified reasonable legal notices author attributions material Appropriate Legal Notices displayed works containing ; c) Prohibiting misrepresentation origin material, requiring modified versions material marked reasonable ways different original version; d) Limiting use publicity purposes names licensors authors material; e) Declining grant rights trademark law use trade names, trademarks, service marks; f) Requiring indemnification licensors authors material anyone conveys material (modified versions ) contractual assumptions liability recipient, liability contractual assumptions directly impose licensors authors. non-permissive additional terms considered “restrictions” within meaning section 10. Program received , part , contains notice stating governed License along term restriction, may remove term. license document contains restriction permits relicensing conveying License, may add covered work material governed terms license document, provided restriction survive relicensing conveying. add terms covered work accord section, must place, relevant source files, statement additional terms apply files, notice indicating find applicable terms. Additional terms, permissive non-permissive, may stated form separately written license, stated exceptions; requirements apply either way.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_8-termination","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"8. Termination","title":"GNU General Public License","text":"may propagate modify covered work except expressly provided License. attempt otherwise propagate modify void, automatically terminate rights License (including patent licenses granted third paragraph section 11). However, cease violation License, license particular copyright holder reinstated () provisionally, unless copyright holder explicitly finally terminates license, (b) permanently, copyright holder fails notify violation reasonable means prior 60 days cessation. Moreover, license particular copyright holder reinstated permanently copyright holder notifies violation reasonable means, first time received notice violation License (work) copyright holder, cure violation prior 30 days receipt notice. Termination rights section terminate licenses parties received copies rights License. rights terminated permanently reinstated, qualify receive new licenses material section 10.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_9-acceptance-not-required-for-having-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"9. Acceptance Not Required for Having Copies","title":"GNU General Public License","text":"required accept License order receive run copy Program. Ancillary propagation covered work occurring solely consequence using peer--peer transmission receive copy likewise require acceptance. However, nothing License grants permission propagate modify covered work. actions infringe copyright accept License. Therefore, modifying propagating covered work, indicate acceptance License .","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_10-automatic-licensing-of-downstream-recipients","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"10. Automatic Licensing of Downstream Recipients","title":"GNU General Public License","text":"time convey covered work, recipient automatically receives license original licensors, run, modify propagate work, subject License. responsible enforcing compliance third parties License. “entity transaction” transaction transferring control organization, substantially assets one, subdividing organization, merging organizations. propagation covered work results entity transaction, party transaction receives copy work also receives whatever licenses work party’s predecessor interest give previous paragraph, plus right possession Corresponding Source work predecessor interest, predecessor can get reasonable efforts. may impose restrictions exercise rights granted affirmed License. example, may impose license fee, royalty, charge exercise rights granted License, may initiate litigation (including cross-claim counterclaim lawsuit) alleging patent claim infringed making, using, selling, offering sale, importing Program portion .","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_11-patents","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"11. Patents","title":"GNU General Public License","text":"“contributor” copyright holder authorizes use License Program work Program based. work thus licensed called contributor’s “contributor version”. contributor’s “essential patent claims” patent claims owned controlled contributor, whether already acquired hereafter acquired, infringed manner, permitted License, making, using, selling contributor version, include claims infringed consequence modification contributor version. purposes definition, “control” includes right grant patent sublicenses manner consistent requirements License. contributor grants non-exclusive, worldwide, royalty-free patent license contributor’s essential patent claims, make, use, sell, offer sale, import otherwise run, modify propagate contents contributor version. following three paragraphs, “patent license” express agreement commitment, however denominated, enforce patent (express permission practice patent covenant sue patent infringement). “grant” patent license party means make agreement commitment enforce patent party. convey covered work, knowingly relying patent license, Corresponding Source work available anyone copy, free charge terms License, publicly available network server readily accessible means, must either (1) cause Corresponding Source available, (2) arrange deprive benefit patent license particular work, (3) arrange, manner consistent requirements License, extend patent license downstream recipients. “Knowingly relying” means actual knowledge , patent license, conveying covered work country, recipient’s use covered work country, infringe one identifiable patents country reason believe valid. , pursuant connection single transaction arrangement, convey, propagate procuring conveyance , covered work, grant patent license parties receiving covered work authorizing use, propagate, modify convey specific copy covered work, patent license grant automatically extended recipients covered work works based . patent license “discriminatory” include within scope coverage, prohibits exercise , conditioned non-exercise one rights specifically granted License. may convey covered work party arrangement third party business distributing software, make payment third party based extent activity conveying work, third party grants, parties receive covered work , discriminatory patent license () connection copies covered work conveyed (copies made copies), (b) primarily connection specific products compilations contain covered work, unless entered arrangement, patent license granted, prior 28 March 2007. Nothing License shall construed excluding limiting implied license defenses infringement may otherwise available applicable patent law.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_12-no-surrender-of-others-freedom","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"12. No Surrender of Others’ Freedom","title":"GNU General Public License","text":"conditions imposed (whether court order, agreement otherwise) contradict conditions License, excuse conditions License. convey covered work satisfy simultaneously obligations License pertinent obligations, consequence may convey . example, agree terms obligate collect royalty conveying convey Program, way satisfy terms License refrain entirely conveying Program.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_13-use-with-the-gnu-affero-general-public-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"13. Use with the GNU Affero General Public License","title":"GNU General Public License","text":"Notwithstanding provision License, permission link combine covered work work licensed version 3 GNU Affero General Public License single combined work, convey resulting work. terms License continue apply part covered work, special requirements GNU Affero General Public License, section 13, concerning interaction network apply combination .","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_14-revised-versions-of-this-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"14. Revised Versions of this License","title":"GNU General Public License","text":"Free Software Foundation may publish revised /new versions GNU General Public License time time. new versions similar spirit present version, may differ detail address new problems concerns. version given distinguishing version number. Program specifies certain numbered version GNU General Public License “later version” applies , option following terms conditions either numbered version later version published Free Software Foundation. Program specify version number GNU General Public License, may choose version ever published Free Software Foundation. Program specifies proxy can decide future versions GNU General Public License can used, proxy’s public statement acceptance version permanently authorizes choose version Program. Later license versions may give additional different permissions. However, additional obligations imposed author copyright holder result choosing follow later version.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_15-disclaimer-of-warranty","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"15. Disclaimer of Warranty","title":"GNU General Public License","text":"WARRANTY PROGRAM, EXTENT PERMITTED APPLICABLE LAW. EXCEPT OTHERWISE STATED WRITING COPYRIGHT HOLDERS /PARTIES PROVIDE PROGRAM “” WITHOUT WARRANTY KIND, EITHER EXPRESSED IMPLIED, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM . PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_16-limitation-of-liability","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"16. Limitation of Liability","title":"GNU General Public License","text":"EVENT UNLESS REQUIRED APPLICABLE LAW AGREED WRITING COPYRIGHT HOLDER, PARTY MODIFIES /CONVEYS PROGRAM PERMITTED , LIABLE DAMAGES, INCLUDING GENERAL, SPECIAL, INCIDENTAL CONSEQUENTIAL DAMAGES ARISING USE INABILITY USE PROGRAM (INCLUDING LIMITED LOSS DATA DATA RENDERED INACCURATE LOSSES SUSTAINED THIRD PARTIES FAILURE PROGRAM OPERATE PROGRAMS), EVEN HOLDER PARTY ADVISED POSSIBILITY DAMAGES.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_17-interpretation-of-sections-15-and-16","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"17. Interpretation of Sections 15 and 16","title":"GNU General Public License","text":"disclaimer warranty limitation liability provided given local legal effect according terms, reviewing courts shall apply local law closely approximates absolute waiver civil liability connection Program, unless warranty assumption liability accompanies copy Program return fee. END TERMS CONDITIONS","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"how-to-apply-these-terms-to-your-new-programs","dir":"","previous_headings":"","what":"How to Apply These Terms to Your New Programs","title":"GNU General Public License","text":"develop new program, want greatest possible use public, best way achieve make free software everyone can redistribute change terms. , attach following notices program. safest attach start source file effectively state exclusion warranty; file least “copyright” line pointer full notice found. Also add information contact electronic paper mail. program terminal interaction, make output short notice like starts interactive mode: hypothetical commands show w show c show appropriate parts General Public License. course, program’s commands might different; GUI interface, use “box”. also get employer (work programmer) school, , sign “copyright disclaimer” program, necessary. information , apply follow GNU GPL, see . GNU General Public License permit incorporating program proprietary programs. program subroutine library, may consider useful permit linking proprietary applications library. want , use GNU Lesser General Public License instead License. first, please read .","code":" Copyright (C)     This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.  You should have received a copy of the GNU General Public License along with this program.  If not, see .   Copyright (C)    This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details."},{"path":"https://b-rodrigues.github.io/rix/articles/a-getting-started.html","id":"the-nix-package-manager","dir":"Articles","previous_headings":"","what":"The Nix package manager","title":"a - Getting started","text":"Nix package manager can installed computer (regardless OS) can used install software like package manager. ’re familiar Ubuntu Linux distribution, likely used apt-get install software. macOS, may used homebrew similar purposes. Nix functions similar way, many advantages classic package managers. main advantage Nix, least purposes, repository software huge. writing, contains 80.000 packages, entirety CRAN Bioconductor available Nix’s repositories. means using Nix, possible install R, also packages required project. obvious question use Nix instead simply installing R R packages usual. answer Nix makes sure install every dependency package, required system libraries. example, xlsx package requires Java programming language installed computer successfully install. can difficult achieve, xlsx bullied many R developers throughout years (especially using Linux distribution, sudo R CMD javareconf still plagues nightmares). Nix, suffices declare want xlsx package project, Nix figures automatically Java required installs configures . just happens without required intervention user. second advantage Nix possible pin certain revision Nix packages’ repository (called nixpkgs) project. Pinning revision ensures every package Nix installs always exactly versions, regardless future packages get installed.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/a-getting-started.html","id":"rix-workflow","dir":"Articles","previous_headings":"","what":"rix workflow","title":"a - Getting started","text":"idea rix declare environment need using provided rix() function. rix() package’s main function generates file called default.nix used Nix package manager build environment. Ideally, set environment projects. can use environment either work interactively, run R scripts. possible many environments projects, software common environments simply re-used get re-installed save space. Environments isolated , can still interact system’s files, unlike Docker volume must mounted. Environments can also interact software installed computer usual means, can sometimes lead issues. provided functions documentation avoid , take time read vignettes fine. rix() several arguments: R version need project; list R packages project needs; optional list additional software (example Python interpreter, Quarto); optional list packages install Github; optional list LaTeX packages; whether want use RStudio IDE project (VS Code, another environment); path save default.nix file (default current working directory) example: call writes default.nix file current working directory. default.nix can turn used Nix build environment containing latest version R, dplyr {chronicler} packages. Take note ide = \"\" argument: argument, values can take, discussed vignette vignette(\"e-interactive-use\") continue reading vignette vignettes numbered “d”.","code":"rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"chronicler\"),     ide = \"other\")"},{"path":"https://b-rodrigues.github.io/rix/articles/a-getting-started.html","id":"using-default-nix-files","dir":"Articles","previous_headings":"rix workflow","what":"Using default.nix files","title":"a - Getting started","text":"Nix package manager can used build reproducible development environments according specifications found generated default.nix files, contain Nix expression. expression Nix jargon function multiple inputs one output, output development environment. rix require Nix installed generate valid expressions (require internet connection), generate expressions use machines. actually build environment using default.nix file, go chose write (ideally new, empty folder root folder project) use Nix package manager build environment. Call following function terminal: Nix done building environment, can start working interactively using following command terminal emulator (R console): drop Nix shell provides installed software. Now know Nix rix, time get tools installed system. ’re running either Linux Windows, read Linux Windows vignette: vignette(\"b1-setting---using-rix--linux--windows\") ’re running macOS, read macOS vignette: vignette(\"b2-setting---using-rix--macos\")","code":"nix-build nix-shell"},{"path":"https://b-rodrigues.github.io/rix/articles/b1-setting-up-and-using-rix-on-linux-and-windows.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"b1 - Setting up and using rix on Linux and Windows","text":"comes Nix, really two supported operating systems: macOS Linux distributions. Windows “supported” actually running Linux thanks WSL2. practice means Linux distributions Windows can considered one system, macOS another, separate, system. Windows really running Linux hood thanks WSL2, means WSL2 needs running Windows system attempt install Nix. important know can run rix even don’t Nix installed, means can generate Nix expressions, just can’t build .","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/b1-setting-up-and-using-rix-on-linux-and-windows.html","id":"windows-pre-requisites","dir":"Articles","previous_headings":"Introduction","what":"Windows pre-requisites","title":"b1 - Setting up and using rix on Linux and Windows","text":"Windows, need Windows Subsystem Linux 2 (WSL2) run Nix. recent version Windows 10 11, can simply run administrator PowerShell: can find installation notes official MS documentation. recommend activate systemd Ubuntu WSL2, mainly supports users root running Nix. set , please outlined official Ubuntu blog entry: Afterwards, can install Nix like business usual. can proceed Determinate Systems installer.","code":"wsl --install # in WSL2 Ubuntu shell  sudo -i nano /etc/wsl.conf  # add this entry  [boot] systemd=true  # then restart running instance from PowerShell  wsl --shutdown  # relaunch Ubuntu WSL2"},{"path":"https://b-rodrigues.github.io/rix/articles/b1-setting-up-and-using-rix-on-linux-and-windows.html","id":"installing-nix","dir":"Articles","previous_headings":"","what":"Installing Nix","title":"b1 - Setting up and using rix on Linux and Windows","text":"can use rix generate Nix expressions even don’t Nix installed system, obviously, need install Nix actually want build defined development environment use . Installing (uninstalling) Nix quite simple, thanks installer Determinate Systems, company provides services tools built Nix. Simply open terminal run following line (Windows, decided activate systemd, append --init none command. can find details Determinate Nix Installer page): Nix installed, can build expressions generate rix! Linux, Nix installed, software installed Nix saved /nix directory root partition. common Linux users separate partition /, may small. Complete development environments built Nix can take much space, available space root partition limited, advise mount /nix folder another partition space (example, secondary hard drive). , edit /etc/fstab add following line end: map /nix /home/path_to/nix can larger partition. enough space root partition, can ignore instructions.","code":"curl --proto '=https' --tlsv1.2 -sSf \\     -L https://install.determinate.systems/nix | \\      sh -s -- install /home/path_to/nix /nix none bind 0 0"},{"path":"https://b-rodrigues.github.io/rix/articles/b1-setting-up-and-using-rix-on-linux-and-windows.html","id":"what-if-you-dont-have-r-already-installed","dir":"Articles","previous_headings":"","what":"What if you don’t have R already installed?","title":"b1 - Setting up and using rix on Linux and Windows","text":"successfully installed Nix, don’t yet R installed system, install R usually operating system, install rix package, , generated project-specific expressions build . also install R using Nix. Running following line terminal drop interactive R session can use start generating expressions: immediately start R session inside terminal. can now run something like : generate default.nix, use file generate environment R, dplyr ggplot2. need add packages project, rerun command , add needed packages r_pkgs. detailled vignette vignette(\"d1-installing-r-packages---nix-environment\") vignette(\"d2-installing-system-tools--texlive-packages---nix-environment\").","code":"nix-shell --expr \"$(curl -sl https://raw.githubusercontent.com/b-rodrigues/rix/master/inst/extdata/default.nix)\" rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"other\",     project_path = \".\",     overwrite = TRUE)"},{"path":"https://b-rodrigues.github.io/rix/articles/b1-setting-up-and-using-rix-on-linux-and-windows.html","id":"generating-expressions","dir":"Articles","previous_headings":"","what":"Generating expressions","title":"b1 - Setting up and using rix on Linux and Windows","text":"R installed, either usual installer operating system, Nix explained previously, can now start building project-specific development environments. Start R session, install rix ’s already done. rix yet CRAN, easiest way install r-universe: can use rix package generate expressions. Consult next vignette vignette(\"c-using-rix--build-project-specific-environments\") learn .","code":"install.packages(\"rix\", repos = c(\"https://b-rodrigues.r-universe.dev\",   \"https://cloud.r-project.org\"))"},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"b2 - Setting up and using rix on macOS","text":"comes Nix, really two supported operating systems: macOS Linux distributions. Windows “supported” actually running Linux thanks WSL2. practice means Linux distributions Windows can considered one system, macOS another, separate, system, idiosyncracies. vignette details .","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"installing-nix","dir":"Articles","previous_headings":"","what":"Installing Nix","title":"b2 - Setting up and using rix on macOS","text":"can use rix generate Nix expressions even don’t Nix installed system, obviously, need install Nix actually want build defined development environment use . Installing (uninstalling) Nix quite simple, thanks installer Determinate Systems, company provides services tools built Nix. Simply open terminal run following line: Nix installed, can build expressions generate rix!","code":"curl --proto '=https' --tlsv1.2 -sSf \\     -L https://install.determinate.systems/nix | \\      sh -s -- install"},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"what-if-you-dont-have-r-already-installed","dir":"Articles","previous_headings":"","what":"What if you don’t have R already installed?","title":"b2 - Setting up and using rix on macOS","text":"successfully installed Nix, don’t yet R installed system, install R usually operating system, install rix package, , generated project-specific expressions build . also install R using Nix. Running following line terminal drop interactive R session can use start generating expressions: immediately start R session inside terminal. can now run something like : generate default.nix, use file generate environment R, dplyr ggplot2. need add packages project, rerun command , add needed packages r_pkgs. detailed vignettes vignette(\"d1-installing-r-packages---nix-environment\") vignette(\"d2-installing-system-tools--texlive-packages---nix-environment\").","code":"nix-shell --expr \"$(curl -sl https://raw.githubusercontent.com/b-rodrigues/rix/master/inst/extdata/default.nix)\" rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"other\",     project_path = \".\",     overwrite = TRUE)"},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"generating-expressions","dir":"Articles","previous_headings":"","what":"Generating expressions","title":"b2 - Setting up and using rix on macOS","text":"R installed, either usual installer operating system, Nix explained previously, can now start building project-specific development environments. macOS, generating expressions works just like Linux Windows. Start R session, install rix ’s already done. rix yet CRAN, easiest way install r-universe: can use rix package generate expressions. Consult next vignette vignette(\"c-using-rix--build-project-specific-environments\") learn .","code":"install.packages(\"rix\", repos = c(\"https://b-rodrigues.r-universe.dev\",   \"https://cloud.r-project.org\"))"},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"shared-libraries-issue","dir":"Articles","previous_headings":"More macOS specificities","what":"Shared libraries issue","title":"b2 - Setting up and using rix on macOS","text":"using environments built Nix macOS, might get crashes (segmentation faults) refering “shared libraries”. indicate user library R packages interfering project-specific Nix environment. system’s user library Nix packaged R default includes appears search paths (check libPaths()). macOS, user library /Library/Frameworks/R.framework/Versions/.-/Resources/library; observed crashes R packages depend system libraries, {data.table} {dplyr}, (reverse) dependencies. user libraries system also appear search path R nixpkgs Linux, think good idea force isolation R packages making behave runtime-pure manner. make happen, recommend set project-specific .Rprofile using rix::rix_init(). way, packages declaratively defined default.nix built part Nix store (one R package one separate derivation listed unique Nix path) appear R library path. example, call rix::rix() like .","code":"# see ?rix_init for more details  rix_init(   project_path = \"./rix_darwin\",   rprofile_action = \"create_missing\" )"},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"rstudio-and-other-development-interfaces-on-macos","dir":"Articles","previous_headings":"More macOS specificities","what":"RStudio and other development interfaces on macOS","title":"b2 - Setting up and using rix on macOS","text":"writing, RStudio installed nixpkgs macOS, wish use RStudio Nix environment, install nixpkgs. means impossible use RStudio Nix environment macOS. try generate expression ide = \"rstudio\" macOS, raise warning. options : ignore warning, environment built Linux distribution (even though generated expression macOS) used Linux distribution; change ide = argument either \"\" \"code\". Use \"code\" want use VS Code \"\" editor, like Vim Emacs. editors don’t need installed nixpkgs use Nix environments, unlike RStudio; ’re working pipeline targets package, run Github Actions. means work code RStudio outside Nix environment, code executed Github Actions runners. See vignette vignette(\"z-advanced-topic-reproducible-analytical-pipelines--nix\") details; work project usual, using usual installation R RStudio, generate default.nix end ide = \"\" right version R reproducibility purposes; use subshells execute code need run specific environment. See vignette vignette(\"z-advanced-topic-running-r--shell-code--nix--r\"); help us package RStudio macOS nixpgs. See , Nix expression RStudio. recommend continue next vignette tackling advanced topics listed : vignette(\"c-using-rix--build-project-specific-environments\").","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"path-of-nix-installation-not-in-path","dir":"Articles","previous_headings":"Why do we need all these special tweaks?","what":"Path of Nix installation not in PATH","title":"b2 - Setting up and using rix on macOS","text":"using RStudio Desktop macOS, typically launch Applications folder. However, RStudio currently lacks option start integrated R session via shell startup macOS (see issue RStudio Linux flavors, PATH properly inherited R sessions. result, key environmental variables UNIX systems, like PATH, properly loaded default shell (e.g., zsh, via ~/.zshrc). Also, RStudio overwrites PATH variable set via .Rprofile .Renviron defaults, makes impossible find Nix standard Nix tools like nix-build. ’s worth noting doesn’t impact rix::rix(), generates R expressions doesn’t require Nix installation. workaround, added mechanisms nix_build() with_nix() append path Nix store PATH variable active session automatically (via Sys.setenv(), use RStudio macOS. don’t anything. covered, get friendly message informs . special side effect.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/c-using-rix-to-build-project-specific-environments.html","id":"project-specific-nix-environments","dir":"Articles","previous_headings":"","what":"Project-specific Nix environments","title":"c - Using rix to build project specific environments","text":"Now required software installed, ’s time learn declaring using reproducible inveronments. ideal workflow using rix create new, separate environment start project. Let’s say wish analyse data set, need dplyr ggplot2. Let’s also suppose use VS Code IDE (discussion editors vignette vignette(\"e-interactive-use\") now, let’s assume use VS Code). rix::rix() function, can easily generate right default.nix file. need provide following inputs rix(): r_ver: version R required. Use “latest” latest version; r_pkgs: required R packages. example “dplyr” (vignette vignette(\"d1-installing-r-packages---nix-environment\")); system_pkgs: required system packages, needed. example “quarto”, Python interpreter (vignette vignette(\"d2-installing-system-tools--texlive-packages---nix-environment\")); git_pkgs: list git packages add (vignette vignette(\"d1-installing-r-packages---nix-environment\")); ide: integrated development editor use (vignette vignette(\"e-interactive-use\")) path: path save default.nix file. overwrite: whether overwrite default.nix file . print: whether print default.nix file console . Run following command generate right default.nix file: start using environment, open terminal folder containing default.nix use following Nix command: nix-build Nix command builds environment according specifications found default.nix file. environment done building, find new file called result next default.nix file. file symlink software installed Nix. rix also provides nix_build() function build Nix environments within interactive R session, always guaranteed succeed, due differences platforms. explained detail following vignette vignette(\"z-advanced-topic-running-r--shell-code--nix--r\"). case doubt, run nix-build usual terminal application. now use environment, type terminal : activate environment. VS Code installed can start environment VS Code use specific R version library packages. explore greater detail vignette vignette(\"e-interactive-use\").","code":"path_default_nix <- tempdir()  rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"code\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 #> # with following call: #> # >rix(r_ver = \"9a9a7552431c4f1a3b2eee9398641babf7c30d0e\", #> #  > r_pkgs = c(\"dplyr\", #> #  > \"ggplot2\"), #> #  > system_pkgs = NULL, #> #  > git_pkgs = NULL, #> #  > ide = \"code\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE, #> #  > print = TRUE) #> # It uses nixpkgs' revision 9a9a7552431c4f1a3b2eee9398641babf7c30d0e 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/9a9a7552431c4f1a3b2eee9398641babf7c30d0e.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) dplyr ggplot2 languageserver; #> }; #>    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 = [  rpkgs  system_packages  ]; #>        #>   } nix-build nix-shell"},{"path":"https://b-rodrigues.github.io/rix/articles/c-using-rix-to-build-project-specific-environments.html","id":"running-old-projects-with-rix","dir":"Articles","previous_headings":"","what":"Running old projects with {rix}","title":"c - Using rix to build project specific environments","text":"example shows create default.nix instructions build environment R version 4.2.1, dplyr janitor packages specific IDE: file looks like : first line quite important, shows revision nixpkgs used environment. revision commit hash particular release nixpkgs, : 79b3d4bcae8. revision nixpkgs one shipped version 4.2.1 R, dplyr janitor packages get installed versions available revision well. means R versions package versions always coupled using Nix. However, need specific version R, also specific version package available particular Nix revision, one solution install package Github fro CRAN archives. Read vignette vignette(\"d1-installing-r-packages---nix-environment\") know . know versions R available, read documention available_r().","code":"path_default_nix <- tempdir()  rix(r_ver = \"4.2.1\",     r_pkgs = c(\"dplyr\", \"janitor\"),     system_pkgs = c(\"quarto\"),     git_pkgs = NULL,     ide = \"other\",     project_path = path_default_nix,     overwrite = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 #> # with following call: #> # >rix(r_ver = \"79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a\", #> #  > r_pkgs = c(\"dplyr\", #> #  > \"janitor\"), #> #  > system_pkgs = c(\"quarto\"), #> #  > git_pkgs = NULL, #> #  > ide = \"other\", #> #  > 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/b-rodrigues/rix #> let #>  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) dplyr janitor; #> }; #>    system_packages = builtins.attrValues { #>   inherit (pkgs) R glibcLocales nix quarto; #> }; #>   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 = [  rpkgs  system_packages  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/c-using-rix-to-build-project-specific-environments.html","id":"running-programs-from-an-environment","dir":"Articles","previous_headings":"","what":"Running programs from an environment","title":"c - Using rix to build project specific environments","text":"create bash script put path make process launching editor environment streamlined. example, project called housing, create script execute start project: execute VS Code environment housing project. use targets execute pipeline environment running:","code":"#!/bin/bash nix-shell /absolute/path/to/housing/default.nix --run code cd /absolute/path/to/housing/ && nix-shell default.nix --run \"Rscript -e 'targets::tar_make()'\""},{"path":"https://b-rodrigues.github.io/rix/articles/c-using-rix-to-build-project-specific-environments.html","id":"running-single-functions-in-a-subshell","dir":"Articles","previous_headings":"","what":"Running single functions in a subshell","title":"c - Using rix to build project specific environments","text":"also possible run single functions isolated environment active R session using with_nix() get output function loaded current session. Refer vignette vignette(\"z-advanced-topic-running-r--shell-code--nix--r\") details achieve . Concretely means running R version 4.3.2 (installed via Nix, ), execute function R version 4.0.0 example subshell (execute function requires old version package subshell), get result computation back main R session.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/c-using-rix-to-build-project-specific-environments.html","id":"nix-environments-are-not-completely-isolated-from-your-system","dir":"Articles","previous_headings":"","what":"Nix environments are not completely isolated from your system","title":"c - Using rix to build project specific environments","text":"important know environment built Nix totally isolated rest system. Suppose program sl installed system, suppose build Nix environment also comes sl. activate environment, version sl run called one included Nix environment. , however, start sl Nix environment come , system’s sl get used instead. also possible completely isolate environment built Nix using provided rix_init() function activate environment using nix-shell --pure instead nix-shell. especially useful subshells.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/d1-installing-r-packages-in-a-nix-environment.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"d1 - Installing R packages in a Nix environment","text":"now know declare build reproducible development environments using rix Nix. vignette explain install specific versions CRAN packages install packages GitHub.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/d1-installing-r-packages-in-a-nix-environment.html","id":"installing-old-packages-archived-on-cran","dir":"Articles","previous_headings":"","what":"Installing old packages archived on CRAN","title":"d1 - Installing R packages in a Nix environment","text":"possible install arbitrary version package archived CRAN: expression install R version 4.2.1, dplyr version 0.8.0 janitor version 1.0.0. can useful, especially packages archived, otherwise, feature ideally used sparingly. want reconstruct environment around 2019, use version R current time. ensure every package gets installed version compatible version R, might case need install old version one particular package.","code":"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 = \"other\",     project_path = path_default_nix,     overwrite = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 #> # with following call: #> # >rix(r_ver = \"79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a\", #> #  > r_pkgs = c(\"dplyr@0.8.0\", #> #  > \"janitor@1.0.0\"), #> #  > system_pkgs = NULL, #> #  > git_pkgs = NULL, #> #  > ide = \"other\", #> #  > 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/b-rodrigues/rix #> let #>  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a.tar.gz\") {}; #>   git_archive_pkgs = [ (pkgs.rPackages.buildRPackage { #>     name = \"dplyr\"; #>     src = pkgs.fetchzip { #>       url = \"https://cran.r-project.org/src/contrib/Archive/dplyr/dplyr_0.8.0.tar.gz\"; #>       sha256 = \"sha256-f30raalLd9KoZKZSxeTN71PG6BczXRIiP6g7EZeH09U=\"; #>     }; #>     propagatedBuildInputs = builtins.attrValues { #>       inherit (pkgs.rPackages) assertthat glue magrittr pkgconfig R6 Rcpp rlang tibble tidyselect BH plogr; #>     }; #>   }) #> (pkgs.rPackages.buildRPackage { #>     name = \"janitor\"; #>     src = pkgs.fetchzip { #>       url = \"https://cran.r-project.org/src/contrib/Archive/janitor/janitor_1.0.0.tar.gz\"; #>       sha256 = \"sha256-3NJomE/CNbOZ+ohuVZJWe2n1RVGUm8x8a0A0qzLmdN4=\"; #>     }; #>     propagatedBuildInputs = builtins.attrValues { #>       inherit (pkgs.rPackages) dplyr tidyr snakecase magrittr purrr rlang; #>     }; #>   })]; #>   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   system_packages  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/d1-installing-r-packages-in-a-nix-environment.html","id":"installing-packages-from-github","dir":"Articles","previous_headings":"","what":"Installing packages from Github","title":"d1 - Installing R packages in a Nix environment","text":"also possible install packages Github: install two packages Github: {housing} package specifically code fusen branch. commit also provided, pin exact version package needed. fusen package also installed, main branch commit d617172447d.","code":"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/\",                    branch_name = \"fusen\",                    commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"),                  list(package_name = \"fusen\",                    repo_url = \"https://github.com/ThinkR-open/fusen\",                    branch_name = \"main\",                    commit = \"d617172447d2947efb20ad6a4463742b8a5d79dc\")     ),     ide = \"other\",     project_path = path_default_nix,     overwrite = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 #> # 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/\", #> #  > branch_name = \"fusen\", #> #  > commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"), #> #  > list(package_name = \"fusen\", #> #  > repo_url = \"https://github.com/ThinkR-open/fusen\", #> #  > branch_name = \"main\", #> #  > commit = \"d617172447d2947efb20ad6a4463742b8a5d79dc\")), #> #  > ide = \"other\", #> #  > 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/b-rodrigues/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/\"; #>       branchName = \"fusen\"; #>       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\"; #>       branchName = \"main\"; #>       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  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/d1-installing-r-packages-in-a-nix-environment.html","id":"a-complete-example","dir":"Articles","previous_headings":"","what":"A complete example","title":"d1 - Installing R packages in a Nix environment","text":"example shows install packages CRAN, CRAN archives GitHub: next vignette, vignette(\"d2-installing-system-tools--texlive-packages---nix-environment\"), explains can install tools text editors, git, Quarto, TexLive packages, tool available nixpkgs development environments.","code":"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/\",                    branch_name = \"fusen\",                    commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"),                  list(package_name = \"fusen\",                    repo_url = \"https://github.com/ThinkR-open/fusen\",                    branch_name = \"main\",                    commit = \"d617172447d2947efb20ad6a4463742b8a5d79dc\")     ),     ide = \"other\",     project_path = path_default_nix,     overwrite = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 #> # with following call: #> # >rix(r_ver = \"79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a\", #> #  > r_pkgs = c(\"dplyr\", #> #  > \"janitor\", #> #  > \"AER@1.2-8\"), #> #  > git_pkgs = list(list(package_name = \"housing\", #> #  > repo_url = \"https://github.com/rap4all/housing/\", #> #  > branch_name = \"fusen\", #> #  > commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"), #> #  > list(package_name = \"fusen\", #> #  > repo_url = \"https://github.com/ThinkR-open/fusen\", #> #  > branch_name = \"main\", #> #  > commit = \"d617172447d2947efb20ad6a4463742b8a5d79dc\")), #> #  > ide = \"other\", #> #  > 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/b-rodrigues/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/\"; #>       branchName = \"fusen\"; #>       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\"; #>       branchName = \"main\"; #>       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; #>     }; #>   }) (pkgs.rPackages.buildRPackage { #>     name = \"AER\"; #>     src = pkgs.fetchzip { #>       url = \"https://cran.r-project.org/src/contrib/Archive/AER/AER_1.2-8.tar.gz\"; #>       sha256 = \"sha256-OqxXcnUX/2C6wfD5fuNayc8OU+mstI3tt4eBVGQZ2S0=\"; #>     }; #>     propagatedBuildInputs = builtins.attrValues { #>       inherit (pkgs.rPackages) car lmtest sandwich survival zoo Formula; #>     }; #>   })]; #>   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  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/d2-installing-system-tools-and-texlive-packages-in-a-nix-environment.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"d2 - Installing system tools and TexLive packages in a Nix environment","text":"80’000 pieces software available Nix package manager. Nix’s repository packages called nixpkgs includes entirety CRAN Bioconductor. nixpkgs actually “just” Github repository containing thousands upon thousands Nix expressions. installing package, expressions get evaluated, package question gets installed. “installed” means can vary: sometimes package gets built source, sometimes pre-compiled binary package operating system gets downloaded made available. example, Nix expression downloads installs Quarto. example expression downloads pre-compiled binary Quarto’s Github repository, installs . installation process case essentially making sure Quarto able find dependencies, also get installed Nix, R Python packages make Quarto work well languages also get installed. possible use rix() add tools environment vignette explains .","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/d2-installing-system-tools-and-texlive-packages-in-a-nix-environment.html","id":"adding-tools-to-an-environment","dir":"Articles","previous_headings":"","what":"Adding tools to an environment","title":"d2 - Installing system tools and TexLive packages in a Nix environment","text":"call generates default.nix defines environment latest version R. R quarto package also installed, well quarto command line tool (required edit Quarto documents R using quarto package) git: can look available software . Simply look right package name, add system_pkgs argument rix(). trouble finding something, don’t hesitate open issue ask support!","code":"path_default_nix <- tempdir()  rix(r_ver = \"latest\",     r_pkgs = c(\"quarto\"),     system_pkgs = c(\"quarto\", \"git\"),     git_pkgs = NULL,     ide = \"other\",     project_path = path_default_nix,     overwrite = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 #> # with following call: #> # >rix(r_ver = \"9a9a7552431c4f1a3b2eee9398641babf7c30d0e\", #> #  > r_pkgs = c(\"quarto\"), #> #  > system_pkgs = c(\"quarto\", #> #  > \"git\"), #> #  > git_pkgs = NULL, #> #  > ide = \"other\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE) #> # It uses nixpkgs' revision 9a9a7552431c4f1a3b2eee9398641babf7c30d0e 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/9a9a7552431c4f1a3b2eee9398641babf7c30d0e.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) quarto; #> }; #>    system_packages = builtins.attrValues { #>   inherit (pkgs) R glibcLocales nix quarto git; #> }; #>   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 = [  rpkgs  system_packages  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/d2-installing-system-tools-and-texlive-packages-in-a-nix-environment.html","id":"installing-texlive-packages","dir":"Articles","previous_headings":"","what":"Installing TexLive packages","title":"d2 - Installing system tools and TexLive packages in a Nix environment","text":"Whether use Quarto, Rmarkdown, Sweave, literate programming R requires TexLive distribution installed. can use rix() install minimalist TexLive distribution add packages require go. basic use simply add TexLive package tex_pkgs argument rix() like : automically add small TexLive distribution available nixpkgs amsmath LaTex package. know setting environments literate programming, refer vignette vignette(\"z-advanced-topic-building--environment--literate-programming\").","code":"path_default_nix <- tempdir()  rix(r_ver = \"latest\",     r_pkgs = c(\"quarto\"),     system_pkgs = \"quarto\",     tex_pkgs = c(\"amsmath\"),     ide = \"other\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 #> # with following call: #> # >rix(r_ver = \"9a9a7552431c4f1a3b2eee9398641babf7c30d0e\", #> #  > r_pkgs = c(\"quarto\"), #> #  > system_pkgs = \"quarto\", #> #  > tex_pkgs = c(\"amsmath\"), #> #  > ide = \"other\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE, #> #  > print = TRUE) #> # It uses nixpkgs' revision 9a9a7552431c4f1a3b2eee9398641babf7c30d0e 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/9a9a7552431c4f1a3b2eee9398641babf7c30d0e.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) quarto; #> }; #>   tex = (pkgs.texlive.combine { #>   inherit (pkgs.texlive) scheme-small amsmath; #> }); #>  system_packages = builtins.attrValues { #>   inherit (pkgs) R glibcLocales nix quarto; #> }; #>   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 = [  rpkgs tex system_packages  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/d2-installing-system-tools-and-texlive-packages-in-a-nix-environment.html","id":"installing-ides","dir":"Articles","previous_headings":"","what":"Installing IDEs","title":"d2 - Installing system tools and TexLive packages in a Nix environment","text":"Environments built Nix completely cut rest system, , able use usual IDE interact Nix environments. exception RStudio. Everything explained greater detail vignette vignette(\"e-interactive-use\").","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/e-interactive-use.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"e - Interactive use","text":"vignette describes interactive use environments built rix using GUI editor like RStudio. discuss three scenarios: one already R RStudio installed operating system using usual installation method operating system, another used Nix install R RStudio, finally last scenario assumes use another IDE RStudio, example VS Code, Emacs, Vim… also possible evaluate single functions inside dedicated, separate, environment another, main, interactive R session. details regarding , refer vignette vignette(\"z-advanced-topic-running-r--shell-code--nix--r\").","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/e-interactive-use.html","id":"scenario-1-you-installed-r-and-rstudio-using-the-usual-installers","dir":"Articles","previous_headings":"","what":"Scenario 1: you installed R and RStudio using the usual installers","title":"e - Interactive use","text":"Let’s suppose already running R RStudio wish start using rix define reproducible environments new projects starting today. environments get built using Nix package manager include required R packages project also specific version R, required system-level dependency well. used using RStudio, also need install RStudio using Nix project-specific environments. RStudio re-defines many environment variables , version RStudio installed using usual installer operating system able “see” R interpreter installed Nix. stated macOS-specific vignette vignette(\"b2-setting---using-rix--macos\"), RStudio available macOS nixpkgs. following instructions thus applicable Linux Windows. ’re macOS, read macOS-specific vignette ’s done already, come back skip “scenario 3” vignette. run project-specific version RStudio R, first need create default.nix file build environment defined therein using Nix. done, need activate environment running project-specific version RStudio. Suppose example generated default.nix file project called “kmeans”, suppose project following path: ~/Documents/kmeans (Windows something like C:\\Users\\Billy\\Documents\\kmeans). example, use rix generate default.nix environment: Navigate folder using terminal, run nix-shell. dropped Nix shell. can type rstudio run project specific version R RStudio required packages project, case dplyr ggplot2. get error might need run typing rstudio: solve issue. case, thankful opened issue encountered bug fix worked . can work usual. can also define shortcut project take care activating environment launching RStudio. way, don’t need start terminal folder drop Nix environment time want work project. example, define bash alias like : execute RStudio right project simply typing kmeans terminal. ’s also possible create executable script can save PATH: (needed, add export QT_XCB_GL_INTEGRATION=none line rstudio). Name script something like kmeans_project, make executable (using chmod +x kmeans_project), now can run RStudio within environment anywhere.","code":"library(rix)  path_to_project <- ~/Documents/kmeans  rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"rstudio\",     project_path = path_to_project,     overwrite = TRUE,     print = TRUE) qt.glx: qglx_findConfig: Failed to finding...  qt.glx: qglx_findConfig: Failed to finding... Could not initialize GLX Aborted (core dumped) export QT_XCB_GL_INTEGRATION=none alias kmeans='nix-shell ~/Documents/kmeans/default.nix --run rstudio #!/usr/bin/env nix-shell #!nix-shell /home/Billy/Document/kmeans/default.nix -i bash rstudio"},{"path":"https://b-rodrigues.github.io/rix/articles/e-interactive-use.html","id":"scenario-2-you-dont-have-any-regular-r-and-rstudio-installation-yet","dir":"Articles","previous_headings":"","what":"Scenario 2: you don’t have any regular R and RStudio installation yet","title":"e - Interactive use","text":"don’t R installed use rix package generate new expressions. case might consider installing Nix first, run following command inside terminal get dropped temporary Nix shell, can use generate new default.nix files: Running command download R rix start R session inside terminal. can now run something like : generate default.nix, use file generate environment R, Rstudio, dplyr ggplot2. need add packages project, rerun command , add needed packages r_pkgs. need create new environment, rerun command , install rix environment generate new default.nix files.","code":"nix-shell --expr \"$(curl -sl https://raw.githubusercontent.com/b-rodrigues/rix/master/inst/extdata/default.nix)\" rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"rstudio\",     # change to a project's path or leave it if you're in the right folder already     project_path = \".\",      overwrite = TRUE)"},{"path":"https://b-rodrigues.github.io/rix/articles/e-interactive-use.html","id":"scenario-3-you-use-some-ide-other-than-rstudio","dir":"Articles","previous_headings":"","what":"Scenario 3: you use some IDE other than RStudio","title":"e - Interactive use","text":"VS Code Emacs tested unlike RStudio, can use version VS Code Emacs installed usual means system development environments built Nix. ’s nothing stopping installing project-specific version VS Code Emacs well wish. Configuration settings accessible across every version every environment, since globally defined level system. means work project using VS Code, use call rix() like : Notice ide = \"code\" argument. install VS Code Nix, install languageserver package needed using R VS Code. want also install project-specific version VS Code, use system_pkgs = \"vscode\" system_pkgs = \"vscodium\" prefer VS Codium VS Code. editor Emacs Vim, set ide = \"\". Also use ide = \"\" want run scripts non-interactively, example CI/CD service.","code":"rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"code\",     project_path = \".\",      overwrite = TRUE)"},{"path":"https://b-rodrigues.github.io/rix/articles/e-interactive-use.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"e - Interactive use","text":"now know basics Nix rix can start using projects! still vignettes recommend read cover advanced topics.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-building-an-environment-for-literate-programming.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"z - Advanced topic: Building an environment for literate programming","text":"vignette walk setting development environment rix can used compile Quarto documents PDFs. going use Quarto template JSS illustrate process. first section show simple way achieving , also ideal interactive development (writing doc). second section discuss way build document completely reproducible manner ’s done.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-building-an-environment-for-literate-programming.html","id":"starting-with-the-basics-simple-but-not-entirely-reproducible","dir":"Articles","previous_headings":"","what":"Starting with the basics (simple but not entirely reproducible)","title":"z - Advanced topic: Building an environment for literate programming","text":"approach optimal, simplest. start building development environment dependencies, can use compile document interactively. approach quite reproducible requires manual actions. next section show build 100% reproducible document single command. Since need quarto R package well quarto engine, add r_pkgs system_pkgs arguments rix. want compile PDF, also need texlive installed, well LaTeX packages. , use tex_pkgs argument: (Save lines script called build_env.R instance, run script new folder made project.) default, rix install “small” version texlive distribution available Nix. see texlive packages get installed small version, can click . start adding amsmath package build environment using: terminal, nix_build() interactive R session. , drop Nix shell nix-shell, run quarto add quarto-journals/jss. install template linked . , folder contains build_env.R, generated default.nix result download following files : article-visualization.pdf bibliography.bib template.qmd try compile template.qmd running: get following error message: ’s R chunk template.qmd uses MASS package. Change build_env.R generate new default.nix file now add MASS environment built: Trying compile document results now another error message: means LaTeX orcidlink package missing, can solve problem adding \"orcidlink\" list tex_pkgs. Rebuild environment try compile template. Trying yields new error: Just , add tcolorbox package list tex_pkgs. need several times packages. unfortunately easier way list dependencies requirements LaTeX document. final script build environment looks like: template now compile environment. look LaTeX package, can use search engine CTAN. stated beginning section, approach optimal, merits, especially ’re still working document. environment set , can simply work doc compile needed using quarto render. next section, explain build 100% reproducible document.","code":"path_default_nix <- tempdir()  rix(r_ver = \"4.3.1\",     r_pkgs = c(\"quarto\"),     system_pkgs = \"quarto\",     tex_pkgs = c(\"amsmath\"),     ide = \"other\",     shell_hook = \"\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 #> # with following call: #> # >rix(r_ver = \"976fa3369d722e76f37c77493d99829540d43845\", #> #  > r_pkgs = c(\"quarto\"), #> #  > system_pkgs = \"quarto\", #> #  > tex_pkgs = c(\"amsmath\"), #> #  > ide = \"other\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE, #> #  > print = TRUE, #> #  > shell_hook = \"\") #> # It uses nixpkgs' revision 976fa3369d722e76f37c77493d99829540d43845 for reproducibility purposes #> # which will install R version 4.3.1 #> # Report any issues to https://github.com/b-rodrigues/rix #> let #>  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/976fa3369d722e76f37c77493d99829540d43845.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) quarto; #> }; #>   tex = (pkgs.texlive.combine { #>   inherit (pkgs.texlive) scheme-small amsmath; #> }); #>  system_packages = builtins.attrValues { #>   inherit (pkgs) R glibcLocales nix quarto; #> }; #>   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 = [  rpkgs tex system_packages  ]; #>        #>   } nix-build quarto render template.qmd --to jss-pdf Quitting from lines 99-101 [unnamed-chunk-1] (template.qmd) Error in `find.package()`: ! there is no package called 'MASS' Backtrace:  1. utils::data(\"quine\", package = \"MASS\")  2. base::find.package(package, lib.loc, verbose = verbose) Execution halted rix(r_ver = \"4.3.1\",     r_pkgs = c(\"quarto\", \"MASS\"),     system_pkgs = \"quarto\",     tex_pkgs = c(\"amsmath\"),     ide = \"other\",     shell_hook = \"\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 #> # with following call: #> # >rix(r_ver = \"976fa3369d722e76f37c77493d99829540d43845\", #> #  > r_pkgs = c(\"quarto\", #> #  > \"MASS\"), #> #  > system_pkgs = \"quarto\", #> #  > tex_pkgs = c(\"amsmath\"), #> #  > ide = \"other\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE, #> #  > print = TRUE, #> #  > shell_hook = \"\") #> # It uses nixpkgs' revision 976fa3369d722e76f37c77493d99829540d43845 for reproducibility purposes #> # which will install R version 4.3.1 #> # Report any issues to https://github.com/b-rodrigues/rix #> let #>  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/976fa3369d722e76f37c77493d99829540d43845.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) quarto MASS; #> }; #>   tex = (pkgs.texlive.combine { #>   inherit (pkgs.texlive) scheme-small amsmath; #> }); #>  system_packages = builtins.attrValues { #>   inherit (pkgs) R glibcLocales nix quarto; #> }; #>   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 = [  rpkgs tex system_packages  ]; #>        #>   } compilation failed- no matching packages LaTeX Error: File `orcidlink.sty' not found compilation failed- no matching packages LaTeX Error: File `tcolorbox.sty' not found. rix(r_ver = \"4.3.1\",     r_pkgs = c(\"quarto\", \"MASS\"),     system_pkgs = \"quarto\",     tex_pkgs = c(       \"amsmath\",       \"environ\",       \"fontawesome5\",       \"orcidlink\",       \"pdfcol\",       \"tcolorbox\",       \"tikzfill\"     ),     ide = \"other\",     shell_hook = \"\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 #> # with following call: #> # >rix(r_ver = \"976fa3369d722e76f37c77493d99829540d43845\", #> #  > r_pkgs = c(\"quarto\", #> #  > \"MASS\"), #> #  > system_pkgs = \"quarto\", #> #  > tex_pkgs = c(\"amsmath\", #> #  > \"environ\", #> #  > \"fontawesome5\", #> #  > \"orcidlink\", #> #  > \"pdfcol\", #> #  > \"tcolorbox\", #> #  > \"tikzfill\"), #> #  > ide = \"other\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE, #> #  > print = TRUE, #> #  > shell_hook = \"\") #> # It uses nixpkgs' revision 976fa3369d722e76f37c77493d99829540d43845 for reproducibility purposes #> # which will install R version 4.3.1 #> # Report any issues to https://github.com/b-rodrigues/rix #> let #>  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/976fa3369d722e76f37c77493d99829540d43845.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) quarto MASS; #> }; #>   tex = (pkgs.texlive.combine { #>   inherit (pkgs.texlive) scheme-small amsmath environ fontawesome5 orcidlink pdfcol tcolorbox tikzfill; #> }); #>  system_packages = builtins.attrValues { #>   inherit (pkgs) R glibcLocales nix quarto; #> }; #>   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 = [  rpkgs tex system_packages  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-building-an-environment-for-literate-programming.html","id":"reproducible-literate-programming","dir":"Articles","previous_headings":"","what":"100% reproducible literate programming","title":"z - Advanced topic: Building an environment for literate programming","text":"Let’s forget Nix just package manager, also programming language. default.nix files rix generates written language, made entirely purpose building software. developer, may realise process compiling Quarto LaTeX document similar process building piece software. can use Nix compile document completely reproducible environment. First, let’s fork repo contains Quarto template need. fork repo. repo contains template.qmd file can change (fork , practice replace template.qmd , finished, source .qmd file). Now need change default.nix: following: changed second part file, ’re building shell anymore using mkShell, derivation. Derivation Nix jargon package, software. derivation? First, clone repo forked just (forked repository called my_paper): repo contains quarto template, ’re using specific commit, always use exactly release template document. contrast used quarto add quarto-journals/jss install template. interactively makes project reproducible compile Quarto doc today, using template today, compile document 6 months, using template 6 months (say possible install specific releases Quarto templates using following notation: quarto add quarto-journals/jss@v0.9.2 problem can mitigated). next part file contains following lines: buildInputs . ’s new buildPhase. actually part document gets compiled. first step create home directory. Quarto needs save template want use /home/.cache/deno. ’re using quarto interactively, ’s issue, since home directory used. Nix, things different, need create empty directory specify home. two lines : ($PWD —Print Working Directory— shell variable referring current working directory.) Now, need install template cloned Github. can use quarto add just , instead installing directly Github, install repository cloned. also add ---prompt flag template gets installed without asking us confirmation. similar building Docker image, don’t want interactive prompt show , else process get stuck. $src refers path downloaded Github repository. Finally can compile document: compile template.qmd (finished paper). Finally, ’s installPhase: $shell variable defined inside build environment refers path, can use create directory contain output (compiled PDF file). use mkdir -p recursively create directory structure, copy compiled document $/. can now build document running nix_build(). Now, may confused fact won’t see PDF working directory. remember software built Nix always stored Nix store, PDF also store, since built. find , run: show path PDF. use open PDF PDF viewer application (Linux least):","code":"let  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/976fa3369d722e76f37c77493d99829540d43845.tar.gz\") {};  rpkgs = builtins.attrValues {    inherit (pkgs.rPackages) quarto MASS;  };  tex = (pkgs.texlive.combine {    inherit (pkgs.texlive) scheme-small amsmath environ fontawesome5 orcidlink pdfcol tcolorbox tikzfill;  });  system_packages = builtins.attrValues {    inherit (pkgs) R quarto;  };  in  pkgs.mkShell {    buildInputs = [  rpkgs tex system_packages  ];  } let  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/976fa3369d722e76f37c77493d99829540d43845.tar.gz\") {};  rpkgs = builtins.attrValues {   inherit (pkgs.rPackages) quarto MASS;  };  tex = (pkgs.texlive.combine {   inherit (pkgs.texlive) scheme-small amsmath environ fontawesome5 orcidlink pdfcol tcolorbox tikzfill;  });  system_packages = builtins.attrValues {   inherit (pkgs) R quarto;  };  in  pkgs.stdenv.mkDerivation {    name = \"my-paper\";    src = pkgs.fetchgit {        url = \"https://github.com/b-rodrigues/my_paper/\";        branchName = \"main\";        rev = \"715e9f007d104c23763cebaf03782b8e80cb5445\";        sha256 = \"sha256-e8Xg7nJookKoIfiJVTGoJkvCuFNTT83YZ6SK3GT2T8g=\";      };    buildInputs = [  rpkgs tex system_packages  ];    buildPhase =      ''      # Deno needs to add stuff to $HOME/.cache      # so we give it a home to do this      mkdir home      export HOME=$PWD/home      quarto add --no-prompt $src      quarto render $PWD/template.qmd --to jss-pdf      '';    installPhase =      ''      mkdir -p $out      cp template.pdf $out/      '';  } pkgs.stdenv.mkDerivation {   name = \"my-paper\";   src = pkgs.fetchgit {       url = \"https://github.com/b-rodrigues/my_paper/\";       branchName = \"main\";       rev = \"715e9f007d104c23763cebaf03782b8e80cb5445\";       sha256 = \"sha256-e8Xg7nJookKoIfiJVTGoJkvCuFNTT83YZ6SK3GT2T8g=\";     }; buildInputs = [  rpkgs tex system_packages  ]; buildPhase =   ''   # Deno needs to add stuff to $HOME/.cache   # so we give it a home to do this   mkdir home   export HOME=$PWD/home   quarto add --no-prompt $src   quarto render $PWD/template.qmd --to jss-pdf   ''; mkdir home export HOME=$PWD/home quarto render $PWD/template.qmd --to jss-pdf installPhase =   ''   mkdir -p $out   cp template.pdf $out/   ''; readlink result xdg-open $(readlink result)/template.pdf"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-building-an-environment-for-literate-programming.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"z - Advanced topic: Building an environment for literate programming","text":"vignette showed two approaches, merits: first approach interactive useful writing document. get access shell can work document compile quickly. second approach useful document ready want way quickly rebuilding reproducibility purposes.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-handling-packages-with-remote-dependencies.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"z - Advanced topic: Handling packages with remote dependencies","text":"Packages published CRAN must dependencies either CRAN Bioconductor, GitHub. However, many packages available GitHub never get published CRAN, packages may even depend packages also available GitHub. rix makes possible install packages GitHub, case one package’s dependencies also released GitHub, building Nix environment fail. Nix looking packages nixpkgs, packages released CRAN Bioconductor available nixpkgs. vignette explains install packages dependencies available GitHub.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-handling-packages-with-remote-dependencies.html","id":"the-lookup-package","dir":"Articles","previous_headings":"","what":"The {lookup} package","title":"z - Advanced topic: Handling packages with remote dependencies","text":"example going use {lookup} package released GitHub. repository. package comes lookup() function makes possible check source code function loaded package, even source function C Fortran. create reproducible development environment makes {lookup} available , use following rix::rix() call: Trying build environment fail following error message:","code":"path_default_nix <- tempdir()  rix(r_ver = \"latest\",     r_pkgs = NULL,     system_pkgs = NULL,     git_pkgs = list(package_name = \"lookup\",                     repo_url = \"https://github.com/jimhester/lookup/\",                     branch_name = \"master\",                     commit = \"eba63db477dd2f20153b75e2949eb333a36cccfc\"),     ide = \"other\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 #> # with following call: #> # >rix(r_ver = \"9a9a7552431c4f1a3b2eee9398641babf7c30d0e\", #> #  > r_pkgs = NULL, #> #  > system_pkgs = NULL, #> #  > git_pkgs = list(package_name = \"lookup\", #> #  > repo_url = \"https://github.com/jimhester/lookup/\", #> #  > branch_name = \"master\", #> #  > commit = \"eba63db477dd2f20153b75e2949eb333a36cccfc\"), #> #  > ide = \"other\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE, #> #  > print = TRUE) #> # It uses nixpkgs' revision 9a9a7552431c4f1a3b2eee9398641babf7c30d0e 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/9a9a7552431c4f1a3b2eee9398641babf7c30d0e.tar.gz\") {}; #>   git_archive_pkgs = [(pkgs.rPackages.buildRPackage { #>     name = \"lookup\"; #>     src = pkgs.fetchgit { #>       url = \"https://github.com/jimhester/lookup/\"; #>       branchName = \"master\"; #>       rev = \"eba63db477dd2f20153b75e2949eb333a36cccfc\"; #>       sha256 = \"sha256-arl7LVxL8xGUW3LhuDCSUjcfswX0rdofL/7v8Klw8FM=\"; #>     }; #>     propagatedBuildInputs = builtins.attrValues { #>       inherit (pkgs.rPackages) gh memoise Rcpp codetools crayon rex highlite jsonlite rstudioapi withr httr; #>     }; #>   }) ]; #>   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   system_packages  ]; #>        #>   } error: attribute 'highlite' missing"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-handling-packages-with-remote-dependencies.html","id":"building-remote-dependencies","dir":"Articles","previous_headings":"","what":"Building remote dependencies","title":"z - Advanced topic: Handling packages with remote dependencies","text":"{highlite} dependency {lookup} available GitHub. can checked looking DESCRIPTION file {lookup}: see actually three packages come GitHub: gh memoise meantime released CRAN, means also available nixpkgs. deal {highlite} however, never got released CRAN. fairly easy: first, create new expression using rix install {highlite}: (don’t need overwrite previous expression, simply printing one screen ). Copy following lines: previous expression (change git_archive_pkgs highlite). file look like now: thing need change line: : Building expression now succeeds. know quite tedious, moment plans make rix handle remote dependencies automatically. mainly three reasons: packages remote dependencies rare, never CRAN Bioconductor; packages may remote dependencies, dependencies may later available CRAN (memoise gh {lookup}); rix decide user commit use remote dependency (whether use released version dependency CRAN). reasons, believe safer users really need use packages manually edit Nix expressions. Don’t hesitate open issue require assistance.","code":"Remotes:     jimhester/highlite,     gaborcsardi/gh,     hadley/memoise rix(r_ver = \"latest\",     r_pkgs = NULL,     system_pkgs = NULL,     git_pkgs = list(package_name = \"highlite\",                     repo_url = \"https://github.com/jimhester/highlite/\",                     branch_name = \"master\",                     commit = \"767b122ef47a60a01e1707e4093cf3635a99c86b\"),     ide = \"other\",     project_path = path_default_nix,     overwrite = FALSE,     print = TRUE) git_archive_pkgs = [(pkgs.rPackages.buildRPackage {   name = \"highlite\";   src = pkgs.fetchgit {     url = \"https://github.com/jimhester/highlite/\";     branchName = \"master\";     rev = \"767b122ef47a60a01e1707e4093cf3635a99c86b\";     sha256 = \"sha256-lkWMlAi75MYxiBUYnLwxLK9ApXkWanA4Mt7g4qtLpxM=\";   };   propagatedBuildInputs = builtins.attrValues {     inherit (pkgs.rPackages) Rcpp BH;   }; }) ]; let  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/b200e0df08f80c32974a6108ce431d8a8a5e6547.tar.gz\") {};    highlite = [(pkgs.rPackages.buildRPackage {     name = \"highlite\";     src = pkgs.fetchgit {       url = \"https://github.com/jimhester/highlite/\";       branchName = \"master\";       rev = \"767b122ef47a60a01e1707e4093cf3635a99c86b\";       sha256 = \"sha256-lkWMlAi75MYxiBUYnLwxLK9ApXkWanA4Mt7g4qtLpxM=\";     };     propagatedBuildInputs = builtins.attrValues {       inherit (pkgs.rPackages) Rcpp BH;     };   }) ];   git_archive_pkgs = [(pkgs.rPackages.buildRPackage {     name = \"lookup\";     src = pkgs.fetchgit {       url = \"https://github.com/jimhester/lookup/\";       branchName = \"master\";       rev = \"eba63db477dd2f20153b75e2949eb333a36cccfc\";       sha256 = \"sha256-arl7LVxL8xGUW3LhuDCSUjcfswX0rdofL/7v8Klw8FM=\";     };     propagatedBuildInputs = builtins.attrValues {       inherit (pkgs.rPackages) gh memoise Rcpp codetools crayon rex highlite jsonlite rstudioapi withr httr;     };   }) ];  system_packages = builtins.attrValues {   inherit (pkgs) R ; };   in   pkgs.mkShell {     buildInputs = [ git_archive_pkgs  system_packages  ];       shellHook = '' R --vanilla '';   } propagatedBuildInputs = builtins.attrValues {       inherit (pkgs.rPackages) gh memoise Rcpp codetools crayon rex highlite jsonlite rstudioapi withr httr;     }; propagatedBuildInputs = builtins.attrValues {       inherit (pkgs.rPackages) gh memoise Rcpp codetools crayon rex jsonlite rstudioapi withr httr;     } ++ [highlite];"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-reproducible-analytical-pipelines-with-nix.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"z - Advanced topic: Reproducible Analytical Pipelines with Nix","text":"Isolated environments great run pipelines safe reproducible manner. vignette details build reproducible analytical pipeline using environment built Nix contains right version R packages.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-reproducible-analytical-pipelines-with-nix.html","id":"an-example-of-a-reproducible-analytical-pipeline-using-nix","dir":"Articles","previous_headings":"","what":"An example of a reproducible analytical pipeline using Nix","title":"z - Advanced topic: Reproducible Analytical Pipelines with Nix","text":"Suppose ’ve used targets build pipeline project using tailor-made Nix environment. call rix() used build environment: call rix() generates following default.nix file: environment gets built default.nix file contains R version 4.2.2, targets tarchetypes packages, well {housing} packages, package hosted GitHub data useful functions project. Github, gets installed using buildRPackage function Nix. can use environment work project, launch targets pipeline. Github repository contains finalized project. local machine, execute pipeline environment running terminal: wish run pipeline whenever drop Nix shell, add Shell-hook generated default.nix file: Now, time drop Nix shell project using nix-shell, pipeline gets automatically executed. rix also features function called tar_nix_ga() adds GitHub Actions workflow file make pipeline run automatically GitHub Actions. GitHub repository linked file, time changes get pushed, pipeline runs Github Actions results automatically pushed branch called targets-runs. See workflow file . feature heavily inspired adapted targets::github_actions() function.","code":"path_default_nix <- tempdir()  rix(r_ver = \"4.2.2\",     r_pkgs = c(\"targets\", \"tarchetypes\", \"rmarkdown\"),     system_pkgs = NULL,     git_pkgs = list(package_name = \"housing\",                     repo_url = \"https://github.com/rap4all/housing/\",                     branch_name = \"fusen\",                     commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"),     ide = \"other\",     project_path = path_default_nix,     overwrite = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 #> # with following call: #> # >rix(r_ver = \"8ad5e8132c5dcf977e308e7bf5517cc6cc0bf7d8\", #> #  > r_pkgs = c(\"targets\", #> #  > \"tarchetypes\", #> #  > \"rmarkdown\"), #> #  > system_pkgs = NULL, #> #  > git_pkgs = list(package_name = \"housing\", #> #  > repo_url = \"https://github.com/rap4all/housing/\", #> #  > branch_name = \"fusen\", #> #  > commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"), #> #  > ide = \"other\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE) #> # It uses nixpkgs' revision 8ad5e8132c5dcf977e308e7bf5517cc6cc0bf7d8 for reproducibility purposes #> # which will install R version 4.2.2 #> # Report any issues to https://github.com/b-rodrigues/rix #> let #>  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/8ad5e8132c5dcf977e308e7bf5517cc6cc0bf7d8.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) targets tarchetypes rmarkdown; #> }; #>  git_archive_pkgs = [(pkgs.rPackages.buildRPackage { #>     name = \"housing\"; #>     src = pkgs.fetchgit { #>       url = \"https://github.com/rap4all/housing/\"; #>       branchName = \"fusen\"; #>       rev = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"; #>       sha256 = \"sha256-s4KGtfKQ7hL0sfDhGb4BpBpspfefBN6hf+XlslqyEn4=\"; #>     }; #>     propagatedBuildInputs = builtins.attrValues { #>       inherit (pkgs.rPackages) dplyr ggplot2 janitor purrr readxl rlang rvest stringr tidyr; #>     }; #>   }) ]; #>   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  ]; #>        #>   } cd /absolute/path/to/housing/ && nix-shell default.nix --run \"Rscript -e 'targets::tar_make()'\" rix(r_ver = \"4.2.2\",     r_pkgs = c(\"targets\", \"tarchetypes\", \"rmarkdown\"),     system_pkgs = NULL,     git_pkgs = list(package_name = \"housing\",                     repo_url = \"https://github.com/rap4all/housing/\",                     branch_name = \"fusen\",                     commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"),     ide = \"other\",     shell_hook = \"Rscript -e 'targets::tar_make()'\",     project_path = path_default_nix,     overwrite = TRUE)"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"testing-code-in-evolving-software-dependency-environments-with-confidence","dir":"Articles","previous_headings":"","what":"Testing code in evolving software dependency environments with confidence","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"Adhering sound versioning practices crucial ensuring reproducibility software. Despite expertise software engineering, ever-growing complexity continuous development new, potentially disruptive features present significant challenges maintaining code functionality time. pertains backward compatibility also future-proofing. code handles critical production loads relies numerous external software libraries, ’s likely dependencies evolve. Infrastructure--code DevOps principles shine addressing challenges. However, may appear less approachable labor-intensive set average R developer. ready test custom R functions system commands different environment isolated software builds pure build runtime, without leaving R console? Let’s introduce with_nix(). with_nix() evaluate custom R code shell commands command line interfaces provided Nixpkgs Nix environment, thereby bring read-eval-print-loop feeling. can evaluate custom R functions shell commands Nix environments, can also bring results back current R session R objects.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"two-operational-modes-of-computations-in-environments-system-to-nix-and-nix-to-nix","dir":"Articles","previous_headings":"","what":"Two operational modes of computations in environments: ‘System-to-Nix’ and ‘Nix-to-Nix’","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"aim accommodate various use cases, considering gradient declarativity individual sets software environments based personal preferences. two main modes defining comparing code running R system commands (command line interfaces; CLIs) ‘System--Nix’ environments: assume launch R session R version defined host operating system, either terminal integrated development environment like RStudio. need make sure actively control know installed R R packages , versions. may interactively tested custom function pipeline worked current setup. importantly, want check whether get computations running achieve identical results going back Nix revision represent either newer also older versions R package sources. ‘Nix--Nix’ environments: goals testing code 1., want fine-grained control source environment launch with_nix() , . probably way getting passionate Nix user.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"case-study-1-evolution-of-base-r","dir":"Articles","previous_headings":"","what":"Case study 1: Evolution of base R","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"Carefully curated software improves time, R. pick example R changelog, following literal entry R 4.2.0: “.vector() gains data.frame method returns simple named list, also clearing long standing ‘FIXME’ enable .vector(, mode =\"list\"). breaks code relying .vector() return unchanged data frame.” goal illustrate change behavior R versions 4.1.3 R versions 4.2.0 later.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"setting-up-the-r-software-environment-with-nix","dir":"Articles","previous_headings":"Case study 1: Evolution of base R","what":"Setting up the (R) software environment with Nix","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"first create isolated directory prepare Nix environment, write custom .Rprofile file well. default, R derivation Nixpkgs includes user library first position (returned .libPaths()). Startup code written local .Rprofile make sure system’s user library (R_LIBS_USER) excluded library paths load packages . nice install packages Nix-R session environment ad-hoc interactive manner. However, comes cost one needs aware potential run-time pollution packages outside pool paths per package nix store. macOS, experienced high-chance segmentation faults accidentally loading packages linked system libraries system’s user library, give example. rix::rix_init() writes configuration takes care runtime-pure R package libraries declaratively defined Nix builds. Additionally, modifies .libPaths() running R session. generate following .Rprofile file. Next, write default.nix file containing Nix expressions pin R version 4.2.0 Nixpkgs. following expression written default.nix subfolder ./_env_1_R-4-1-3/.","code":"library(\"rix\")  path_env_1 <- file.path(\".\", \"_env_1_R-4-1-3\")  rix_init(   project_path = path_env_1,   rprofile_action = \"overwrite\",   message_type = \"simple\" ) #>  #> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #>  #> ==> Created isolated nix-R project folder: #>  /home/runner/work/rix/rix/vignettes/_env_1_R-4-1-3  #>  #> ==> R session running via host operating system or docker #> * R session not running from RStudio #> ==> Added `.Rprofile` file and code lines for new R sessions launched from: #> /home/runner/work/rix/rix/vignettes/_env_1_R-4-1-3 #>  #> * Added the location of the Nix store to `PATH` environmental variable for new R sessions on host/docker RStudio: #> /nix/var/nix/profiles/default/bin list.files(path = path_env_1, all.files = TRUE) #> [1] \".\"         \"..\"        \".Rprofile\" #> ### File generated by `rix::rix_init()` ### #> # 1. Currently, system RStudio does not inherit environmental variables #> #   defined in `$HOME/.zshrc`, `$HOME/.bashrc` and alike. This is workaround to  #> #   make the path of the nix store and hence basic nix commands available #> #   in an RStudio session #> # 2. For nix-R session, remove `R_LIBS_USER`, system's R user library.`. #> #   This guarantees no user libraries from the system are loaded and only  #> #   R packages in the Nix store are used. This makes Nix-R behave in pure manner #> #   at run-time. #> { #>     is_rstudio <- Sys.getenv(\"RSTUDIO\") == \"1\" #>     is_nixr <- nzchar(Sys.getenv(\"NIX_STORE\")) #>     if (isFALSE(is_nixr) && isTRUE(is_rstudio)) { #>         cat(\"{rix} detected RStudio R session\") #>         old_path <- Sys.getenv(\"PATH\") #>         nix_path <- \"/nix/var/nix/profiles/default/bin\" #>         has_nix_path <- any(grepl(nix_path, old_path)) #>         if (isFALSE(has_nix_path)) { #>             Sys.setenv(PATH = paste(old_path, nix_path, sep = \":\")) #>         } #>         rm(old_path, nix_path) #>     } #>     if (isTRUE(is_nixr)) { #>         current_paths <- .libPaths() #>         userlib_paths <- Sys.getenv(\"R_LIBS_USER\") #>         user_dir <- grep(paste(userlib_paths, collapse = \"|\"), current_paths) #>         new_paths <- current_paths[-user_dir] #>         .libPaths(new_paths) #>         rm(current_paths, userlib_paths, user_dir, new_paths) #>     } #>     rm(is_rstudio, is_nixr) #> } rix(   r_ver = \"4.1.3\",   overwrite = TRUE,   project_path = path_env_1 ) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-12 #> # with following call: #> # >rix(r_ver = \"6e3a86f2f73a466656a401302d3ece26fba401d9\", #> #  > project_path = path_env_1, #> #  > overwrite = TRUE) #> # It uses nixpkgs' revision 6e3a86f2f73a466656a401302d3ece26fba401d9 for reproducibility purposes #> # which will install R version 4.1.3 #> # Report any issues to https://github.com/b-rodrigues/rix #> let #>  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/6e3a86f2f73a466656a401302d3ece26fba401d9.tar.gz\") {}; #>     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 = [    system_packages  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"defining-and-interactively-testing-custom-r-code-with-functions","dir":"Articles","previous_headings":"Case study 1: Evolution of base R","what":"Defining and interactively testing custom R code with function(s)","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"know set configuration R 4.1.3 set default.nix file folder ./_env_1_R-4-1-3. Since sure using R version higher 4.2.0 available system, can check .vector.data.frame() S3 method returns list. different R versions 4.1.3 , get identical data frame back.","code":"df <- data.frame(a = 1:3, b = 4:6) as.vector(x = df, mode =\"list\") #> $a #> [1] 1 2 3 #>  #> $b #> [1] 4 5 6"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"run-functioned-up-code-and-investigate-results-produced-in-pure-nix-rsoftware-environments","dir":"Articles","previous_headings":"Case study 1: Evolution of base R","what":"Run functioned up code and investigate results produced in pure Nix Rsoftware environments","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"formally validate ‘System--Nix’ approach object returned .vector.data.frame() R < 4.2.0, define function runs computation . , evaluate test code nix-shell R session. adds build-time run-time purity declarative Nix software configuration made earlier. with_nix() leverages following principles hood: Computing Language: Manipulating language objects using code. Static Code Analysis: Detecting global objects package environments function call stack ‘expr’. involves utilizing essential functionality ‘codetools’ package, recursively iterated. Serialization Dependent R objects: Saving disk deserializing back R session’s RAM via temporary folder. process establishes isolation two distinct computational environments, accommodating ‘System--Nix’ ‘Nix--Nix’ computational modes. Simultaneously, facilitates transfer input arguments, dependencies across call stack, outputs expr Nix-R system’s R sessions. approach guarantees reproducible side effects effectively streams messages errors R session. Thereby, {sys} package facilitates capturing standard outputs errors text output messages. Please aware with_nix() invoke nix-shell, run nix-build case Nix derivation (package) R version 4.1.3 yet Nix store. take bit time get cache. use exec_mode == \"non-blocking\" argument with_nix(), see current R console specific Nix paths downloaded copied Nix store automatically.","code":"df_as_vector <- function(x) {   out <- as.vector(x = x, mode = \"list\")   return(out) } (out_system_1 <- df_as_vector(x = df)) #> $a #> [1] 1 2 3 #>  #> $b #> [1] 4 5 6 # now run it in `nix-shell`; `with_nix()` takes care # of exporting global objects of `df_as_vector` recursively out_nix_1 <- with_nix(   expr = function() df_as_vector(x = df), # wrap to avoid evaluation   program = \"R\",    exec_mode = \"non-blocking\", # run as background process   project_path = path_env_1,    message_type = \"simple\" # you can do `\"verbose\"`, too )  # compare results of custom codebase with indentical  # inputs and different software environments identical(out_system_1, out_nix_1)  # should return `FALSE` if your system's R versions in # current interactive R session is R >= 4.2.0"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"syntax-option-for-specifying-function-in-expr-argument-of-with_nix","dir":"Articles","previous_headings":"Case study 1: Evolution of base R","what":"Syntax option for specifying function in expr argument of with_nix()","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"previous code snippet wrapped top-level expr function function() function(){}. alternative, can also provide default arguments assigning function used expr input like : , just supply name function evaluate default arguments. yields results.","code":"df_as_vector <- function(x = df) {   out <- as.vector(x = x, mode = \"list\")   return(out) } out_nix_1_b <- with_nix(   expr = df_as_vector, # provide name of function   program = \"R\",    exec_mode = \"non-blocking\", # run as background process   project_path = path_env_1,    message_type = \"simple\" # you can do `\"verbose\"`, too ) Reduce(f = identical, list(out_nix_1, out_nix_1_b))"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"comparing-as-vector-data-frame-for-both-r-versions-4-1-3-and-4-2-0-from-nixpkgs","dir":"Articles","previous_headings":"Case study 1: Evolution of base R","what":"Comparing as.vector.data.frame() for both R versions 4.1.3 and 4.2.0 from Nixpkgs","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"follows example Nix--Nix solution, two subshells track evolution base R specific case. can verify breaking changes case study 1 declarative manner use R 4.1.3 R 4.2.0 Nixpkgs. Since already defined R 4.1.3 env_1_R-4-1-3 subshell, can use source environment with_nix() launched . Accordingly, define R 4.2.0 environment env_1_2_R-4-2-0using Nix via rix::rix(). latter environment target environment df_as_vector() evaluated . Now, initiate new R session development environment using nix-shell. Open new terminal current working directory R session. provided expression default.nix. defines R 4.1.3 “subfolder per subshell” approach. nix-shell use expression default.nix prefer .nix files, except put shell.nix file folder, takes precedence. time downloading caches builds, enter R console session R 4.1.3. need type R first, set R shell hook via rix::rix(). Next, define target function test R 4.2.0, . can now formally compare outputs computation code R 4.1.3 vs. R 4.2.0 environments controlled Nix.","code":"library(\"rix\") path_env_1_2 <- file.path(\".\", \"_env_1_2_R-4-2-0\")  rix_init(   project_path = path_env_1_2,   rprofile_action = \"overwrite\",   message_type = \"simple\" ) #>  #> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #>  #> ==> Created isolated nix-R project folder: #>  /home/runner/work/rix/rix/vignettes/_env_1_2_R-4-2-0  #>  #> ==> R session running via host operating system or docker #> * R session not running from RStudio #> ==> Added `.Rprofile` file and code lines for new R sessions launched from: #> /home/runner/work/rix/rix/vignettes/_env_1_2_R-4-2-0 #>  #> * Added the location of the Nix store to `PATH` environmental variable for new R sessions on host/docker RStudio: #> /nix/var/nix/profiles/default/bin  rix(   r_ver = \"4.2.0\",   overwrite = TRUE,   project_path = path_env_1_2,   shell_hook = \"R\" )  list.files(path_env_1_2) #> [1] \"default.nix\" nix-shell --pure ./_env_1_R-4-1-3 # current Nix-R session with R 4.1.3 df_as_vector <- function(x) {   out <- as.vector(x = x, mode = \"list\")   return(out) } (out_nix_1 <- df_as_vector(x = df)) out_nix_1_2 <- with_nix(   expr = function() df_as_vector(x = df),   program = \"R\",   exec_mode = \"non-blocking\", # run as background process   project_path = path_env_1_2,    message_type = \"simple\" # you can do `\"verbose\"`, too ) identical(out_nix_1, out_nix_1_2) # yields FALSE"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"case-study-2-breaking-changes-in-stringr-1-5-0","dir":"Articles","previous_headings":"","what":"Case study 2: Breaking changes in {stringr} 1.5.0","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"add one layer reproducibility R ecosystem. User libraries CRAN GitHub, one thing makes R shine huge collection software packages available community. change introduce {stringr} 1.5.0; earlier versions, line code: return character \"\". However, behaviour unexpected: really return error. addressed versions 1.5.0: Since code returns error, wrap inside tryCatch() return NULL instead error (wouldn’t , vignette compile!). Let’s build subshell latest version R, older version stringr: call generates default.nix file subshell old version stringr: can now run code subshell last lines printed screen: see result evaluating code subshell, also access : out_nix_stringr holds result. can now compare two: result code running main session latest version stringr result code running subshell old version stringr: expected, result FALSE.","code":"stringr::str_subset(c(\"\", \"a\"), \"\") out_system_stringr <- tryCatch(   expr = {stringr::str_subset(c(\"\", \"a\"), \"\")},   error = function(e)NULL) library(\"rix\")  path_env_stringr <- file.path(\".\", \"_env_stringr_1.4.1\")  rix_init(   project_path = path_env_stringr,   rprofile_action = \"overwrite\",   message_type = \"simple\" ) #>  #> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #>  #> ==> Created isolated nix-R project folder: #>  /home/runner/work/rix/rix/vignettes/_env_stringr_1.4.1  #>  #> ==> R session running via host operating system or docker #> * R session not running from RStudio #> ==> Added `.Rprofile` file and code lines for new R sessions launched from: #> /home/runner/work/rix/rix/vignettes/_env_stringr_1.4.1 #>  #> * Added the location of the Nix store to `PATH` environmental variable for new R sessions on host/docker RStudio: #> /nix/var/nix/profiles/default/bin  list.files(path = path_env_stringr, all.files = TRUE) #> [1] \".\"         \"..\"        \".Rprofile\" rix(   r_ver = \"latest\",   r_pkgs = \"stringr@1.4.1\",   overwrite = TRUE,   project_path = path_env_stringr ) out_nix_stringr <- with_nix(   expr = function() stringr::str_subset(c(\"\", \"a\"), \"\"),   program = \"R\",   exec_mode = \"non-blocking\",   project_path = path_env_stringr,   message_type = \"simple\" ) ==> `expr` succeeded!  ### Finished code evaluation in `nix-shell` ###  * Evaluating `expr` in `nix-shell` returns: [1] \"a\" identical(out_system_stringr, out_nix_stringr)"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"case-study-3-using-a-subshell-to-get-hard-to-install-dependencies","dir":"Articles","previous_headings":"","what":"Case study 3: Using a subshell to get hard to install dependencies","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"Nix subshells quite useful cases need use package might difficult install, arrow, packages must compiled. Depending operating system need compile arrow source, can frustrating experience, especially need load data bring manageable size (using select() filter() instance). use cases illustrates achieve . Let’s start building subshell based distinct revision nixpkgs, know arrow compiles linux macOS (darwin). specific revision R contains arrow 13. Let’s now suppose already script code load transform data using arrow. may look something like : run code subshell, recommend wrapping inside function: can run subshell: run function subshell, output saved out_nix_arrow variable, manipulation main shell/session.","code":"library(\"rix\")  path_env_arrow <- file.path(\"env_arrow\")  rix_init(   project_path = path_env_arrow,   rprofile_action = \"overwrite\",   message_type = \"simple\" )  rix(   r_ver = \"af63e7a15daf283b4ce634006b3767f9c0eb0c58\",   r_pkgs = c(\"dplyr\", \"arrow\"),   overwrite = TRUE,   project_path = path_env_arrow ) library(arrow) library(dplyr)  arrow_cars <- arrow_table(cars)  arrow_cars %>%   filter(speed > 10) %>%   as.data.frame() arrow_script <- function() {   library(arrow)   library(dplyr)    arrow_cars <- arrow_table(cars)    arrow_cars %>%     filter(speed > 10) %>%     as.data.frame() } out_nix_arrow <- with_nix(   expr = function() arrow_script(),   program = \"R\",   exec_mode = \"non-blocking\",   project_path = path_env_arrow,   message_type = \"simple\" )"},{"path":"https://b-rodrigues.github.io/rix/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Bruno Rodrigues. Author, maintainer. Philipp Baumann. Author.","code":""},{"path":"https://b-rodrigues.github.io/rix/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Rodrigues B, Baumann P (2024). rix: Rix: Reproducible Environments Nix. R package version 0.6.0, https://b-rodrigues.github.io/rix/.","code":"@Manual{,   title = {rix: Rix: Reproducible Environments with Nix},   author = {Bruno Rodrigues and Philipp Baumann},   year = {2024},   note = {R package version 0.6.0},   url = {https://b-rodrigues.github.io/rix/}, }"},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"introduction","dir":"","previous_headings":"","what":"Introduction","title":"Rix: Reproducible Environments with Nix","text":"rix R package leverages Nix, powerful package manager focusing reproducible builds. Nix, possible create project-specific environments contain project-specific version R R packages (well tools languages, needed). can use rix Nix replace renv Docker one single tool. Nix incredibly useful piece software ensuring reproducibility projects, research otherwise. example, allows run web applications like Shiny apps plumber APIs controlled environment. Nix fairly high entry cost though. Nix complex piece software comes programming language, also called Nix. purpose solve complex problem: defining instructions build software packages manage configurations declarative way. makes sure software gets installed fully reproducible manner, operating system hardware. rix provides functions help write deploy Nix expressions (written Nix language). expressions inputs Nix package manager, build sets software packages provide reproducible development environment. environments can used interactive data analysis, reproduced running pipelines CI/CD systems. Nixpkgs collection, currently 80.000 pieces software available Nix package manager. {rix}, can define build isolated R environments Nix package manager ease. Like , environments contain R required packages need project. can also add software tool available. Nix R ecosystem currently includes entirety CRAN Bioconductor packages. Like programming language software, also possible install older releases R packages, install packages GitHub defined states. Nix package manager extremely powerful. handle dependencies package extremely well deterministic manner, also possible reproduce environments containing old releases software. thus possible build environments containing R version 4.0.0 (example) run old project originally developed version R. stated , Nix, essentially possible replace {renv} Docker combined. need tools languages like Python Julia, can also done easily. Nix available Linux, macOS Windows (via WSL2) rix comes following features: install version R R packages specific projects; several versions R R packages installed time system; define complete development environments code use anywhere; run single R functions (objects call stack) different environment (potentially different R version R packages) interactive R session, get back output function using with_nix(); rix require Nix installed system generate expressions. means can generate expressions system easily install software, use expressions cloud CI/CD environment build project . R installed, can start straight away R session first installing rix: generates file called default.nix path path_default_nix correct expression build environment. build environment, Nix package manager must installed.","code":"install.packages(\"rix\", repos = c(\"https://b-rodrigues.r-universe.dev\",   \"https://cloud.r-project.org\"))  library(\"rix\") path_default_nix <- \".\"  rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"code\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE)"},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"quick-start-for-returning-users","dir":"","previous_headings":"","what":"Quick start for returning users","title":"Rix: Reproducible Environments with Nix","text":"familiar Nix rix skip next section. already familiar Nix R, simply want get started quickly possible, can start installing Nix using installer Determinate Systems company provides services tools built Nix: can check everything works well trying build Nix expression ships rix. Nix expressions typically saved files name default.nix shell.nix. expression installs latest version R rix separate, reproducible environment: everything worked well, see file called result next default.nix. can now enter newly built development environment opening terminal folder typing nix-shell. immediately dropped interactive R session. don’t R installed, Nix package manager installed, can run temporary R session R using command (build environment one ):","code":"curl --proto '=https' --tlsv1.2 -sSf \\     -L https://install.determinate.systems/nix | \\      sh -s -- install file.copy(   # default.nix is the file containing the Nix expression   from = system.file(\"extdata\", \"default.nix\", package = \"rix\"),   to = \".\", overwrite = TRUE )  # nix_build() is a wrapper around the command line tool `nix-build` nix_build(project_path = \".\") nix-shell --expr \"$(curl -sl https://raw.githubusercontent.com/b-rodrigues/rix/master/inst/extdata/default.nix)\""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"getting-started-for-new-users","dir":"","previous_headings":"","what":"Getting started for new users","title":"Rix: Reproducible Environments with Nix","text":"get started rix Nix, read following vignette vignette(\"-getting-started\") (online documentation). vignettes numbered get learn use rix Nix smoothly. ’s lot info, take time reading vignettes. Don’t hesitate open issue something clear.","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"docker","dir":"","previous_headings":"Getting started for new users","what":"Docker","title":"Rix: Reproducible Environments with Nix","text":"can also try Nix inside Docker. , can start image NixOS Docker image. NixOS full GNU/Linux distribution uses Nix system package manager.","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"contributing","dir":"","previous_headings":"","what":"Contributing","title":"Rix: Reproducible Environments with Nix","text":"package developed using fusen package. want contribute, please edit .Rmd files found dev/ folder. , inflate package using fusen::inflate_all(). errors found (warning notes OK), commit open PR. learn use fusen (don’t worry, ’s super easy), refer vignette. development workflow, use semantic versioning via {fledge}.","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"thanks","dir":"","previous_headings":"","what":"Thanks","title":"Rix: Reproducible Environments with Nix","text":"Thanks Nix community making Nix possible, thanks community R users Nix work packaging R CRAN/Bioconductor packages Nix (particular Justin Bedő, Rémi Nicole, nviets, Chris Hammill, László Kupcsik, Simon Lackerbauer, MrTarantoga every person Matrix Nixpkgs R channel).","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"recommended-reading","dir":"","previous_headings":"","what":"Recommended reading","title":"Rix: Reproducible Environments with Nix","text":"NixOS’s website Nixpkgs’s GitHub repository Nix R series Bruno’s blog. , case like video tutorials, watch one Reproducible R development environments Nix nix.dev tutorials INRIA’s Nix tutorial Nix pills Nix Data Science NixOS explained: NixOS entire Linux distribution uses Nix package manager. Blog post: Nix R devtools Blog post: Statistical Rethinking Nix Blog post: Searching installing old versions Nix packages","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/available_r.html","id":null,"dir":"Reference","previous_headings":"","what":"List available R versions from Nixpkgs — available_r","title":"List available R versions from Nixpkgs — available_r","text":"List available R versions Nixpkgs","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/available_r.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List available R versions from Nixpkgs — available_r","text":"","code":"available_r()"},{"path":"https://b-rodrigues.github.io/rix/reference/available_r.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List available R versions from Nixpkgs — available_r","text":"character vector containing available R versions.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/available_r.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List available R versions from Nixpkgs — available_r","text":"","code":"available_r() #>  [1] \"latest\" \"3.0.2\"  \"3.0.3\"  \"3.1.0\"  \"3.1.2\"  \"3.1.3\"  \"3.2.0\"  \"3.2.1\"  #>  [9] \"3.2.2\"  \"3.2.3\"  \"3.2.4\"  \"3.3.3\"  \"3.4.0\"  \"3.4.1\"  \"3.4.2\"  \"3.4.3\"  #> [17] \"3.4.4\"  \"3.5.0\"  \"3.5.1\"  \"3.5.2\"  \"3.5.3\"  \"3.6.0\"  \"3.6.1\"  \"3.6.2\"  #> [25] \"3.6.3\"  \"4.0.0\"  \"4.0.2\"  \"4.0.3\"  \"4.0.4\"  \"4.1.1\"  \"4.1.2\"  \"4.1.3\"  #> [33] \"4.2.0\"  \"4.2.1\"  \"4.2.2\"  \"4.2.3\"  \"4.3.1\""},{"path":"https://b-rodrigues.github.io/rix/reference/nix_build.html","id":null,"dir":"Reference","previous_headings":"","what":"Invoke shell command nix-build from an R session — nix_build","title":"Invoke shell command nix-build from an R session — nix_build","text":"Invoke shell command nix-build R session","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/nix_build.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Invoke shell command nix-build from an R session — nix_build","text":"","code":"nix_build(project_path = \".\", exec_mode = c(\"blocking\", \"non-blocking\"))"},{"path":"https://b-rodrigues.github.io/rix/reference/nix_build.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Invoke shell command nix-build from an R session — nix_build","text":"project_path Path folder default.nix file resides. default \".\", working directory current R session. exec_mode Either \"blocking\" (default) \"non-blocking. either block R session nix-build shell command executed, run nix-build background (\"non-blocking\").","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/nix_build.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Invoke shell command nix-build from an R session — nix_build","text":"integer process ID (PID) nix-build shell command launched, nix_build() call assigned R object. Otherwise, returned invisibly.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/nix_build.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Invoke shell command nix-build from an R session — nix_build","text":"nix-build command line interface arguments. probably support R wrapper, currently support following nix-build flags: --max-jobs: Maximum number build jobs done parallel Nix. According official docs Nix, defaults 1, one core. option can useful shared memory multiprocessing systems high /O latency. set --max-jobs used, can declare options(rix.nix_build_max_jobs = ). call nix_build() flag propagated call nix-build.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/nix_build.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Invoke shell command nix-build from an R session — nix_build","text":"","code":"if (FALSE) {   nix_build() }"},{"path":"https://b-rodrigues.github.io/rix/reference/r_nix_revs.html","id":null,"dir":"Reference","previous_headings":"","what":"r_nix_revs — r_nix_revs","title":"r_nix_revs — r_nix_revs","text":"Nix revisions old R releases","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/r_nix_revs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"r_nix_revs — r_nix_revs","text":"","code":"r_nix_revs"},{"path":"https://b-rodrigues.github.io/rix/reference/r_nix_revs.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"r_nix_revs — r_nix_revs","text":"data frame 34 rows 3 variables: version R version revision Nix revision containing version R date Date revision available","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/r_nix_revs.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"r_nix_revs — r_nix_revs","text":"Nix Package Version, Marcelo Lazaroni","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":null,"dir":"Reference","previous_headings":"","what":"rix Generates a Nix expression that builds a reproducible development environment — rix","title":"rix Generates a Nix expression that builds a reproducible development environment — rix","text":"rix Generates Nix expression builds reproducible development environment","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"rix Generates a Nix expression that builds a reproducible development environment — rix","text":"","code":"rix(   r_ver = \"latest\",   r_pkgs = NULL,   system_pkgs = NULL,   git_pkgs = NULL,   tex_pkgs = NULL,   ide = \"other\",   project_path = \".\",   overwrite = FALSE,   print = FALSE,   shell_hook = NULL )"},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"rix Generates a Nix expression that builds a reproducible development environment — rix","text":"r_ver Character, defaults \"latest\". required R version, example \"4.0.0\". can check R versions available using available_r. reproducibility purposes, can also provide nixpkgs revision directly. r_pkgs Vector characters. List required R packages analysis . system_pkgs Vector characters. List software wish install R packages command line applications example. can look available software NixOS website https://search.nixos.org/packages?channel=unstable&=0&size=50&sort=relevance&type=packages&query= git_pkgs List. list packages install Git. See details information. tex_pkgs Vector characters. set tex packages install. Use need compile .tex documents, build PDF documents using Quarto. know package add, start adding \"amsmath\". See Vignette \"Authoring LaTeX documents\" details. ide Character, defaults \"\". wish use RStudio work interactively use \"rstudio\" \"code\" Visual Studio Code. editors, use \"\". tested RStudio, VS Code Emacs. editors work, please open issue. project_path Character, defaults current working directory. write default.nix, example \"/home/path//project\". file thus written file \"/home/path//project/default.nix\". overwrite Logical, defaults FALSE. TRUE, overwrite default.nix file specified path. print Logical, defaults FALSE. TRUE, print default.nix console. shell_hook Character length 1, defaults NULL. Commands added shellHook variable executed Nix shell starts. default, using nix-shell default.nix (path shell.nix) start specific program, possibly flags (separated space), /shell actions. can example use shell_hook = R, want directly enter declared Nix R session.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"rix Generates a Nix expression that builds a reproducible development environment — rix","text":"Nothing, function side-effect writing file called \"default.nix\" working directory. file contains expression build reproducible environment using Nix package manager.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"rix Generates a Nix expression that builds a reproducible development environment — rix","text":"function write default.nix chosen path. Using Nix package manager, possible build reproducible development environment using nix-build command path. environment contain chosen version R packages, interfere installed version (via Nix ) machine. Every dependency, including R package dependencies also system dependencies like compilers get installed well environment. use RStudio interactive work, set rstudio parameter TRUE. use another IDE (example Emacs Visual Studio Code), need add default.nix file, can simply use version installed computer. built environment using nix-build, can drop interactive session using nix-shell. See \"Building reproducible development environments rix\" vignette detailled instructions. Packages install Github must provided list 4 elements: \"package_name\", \"repo_url\", \"branch_name\" \"commit\". argument can also list lists 4 elements. also possible install old versions packages specifying version. example, install latest version {AER} old version {ggplot2}, write: r_pkgs = c(\"AER\", \"ggplot2@2.2.1\"). Note however result dependency hell, older version package might need older versions dependencies, packages might need recent versions dependencies. instead want use environment looked time {ggplot2}'s version 2.2.1 release, use Nix revision closest date, setting r_ver = \"3.1.0\", version R current time. ensures Nix builds completely coherent environment. default, nix shell configured \"en_US.UTF-8\" relevant locale variables (LANG, LC_ALL, LC_TIME, LC_MONETARY, LC_PAPER, LC_MEASUREMENT). done ensure locale reproducibility default Nix environments created rix(). good reasons stick default, can set preferred locale variables via options(rix.nix_locale_variables = list(LANG = \"de_CH.UTF-8\", <...>) aforementioned locale variable names.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"rix Generates a Nix expression that builds a reproducible development environment — rix","text":"","code":"if (FALSE) { # Build an environment with the latest version of R # and the dplyr and ggplot2 packages rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"code\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE,     shell_hook = NULL) }"},{"path":"https://b-rodrigues.github.io/rix/reference/rix_init.html","id":null,"dir":"Reference","previous_headings":"","what":"Initiate and maintain an isolated, project-specific, and runtime-pure R\nsetup via Nix. — rix_init","title":"Initiate and maintain an isolated, project-specific, and runtime-pure R\nsetup via Nix. — rix_init","text":"Creates isolated project folder Nix-R configuration. rix::rix_init() also adds, appends, updates without backup custom .Rprofile file code initializes startup R environment without system's user libraries within Nix software environment. Instead, restricts search paths load R packages exclusively Nix store. Additionally, makes Nix utilities like nix-shell available run system commands system's RStudio R session, Linux macOS.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix_init.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initiate and maintain an isolated, project-specific, and runtime-pure R\nsetup via Nix. — rix_init","text":"","code":"rix_init(   project_path = \".\",   rprofile_action = c(\"create_missing\", \"create_backup\", \"overwrite\", \"append\"),   message_type = c(\"simple\", \"verbose\") )"},{"path":"https://b-rodrigues.github.io/rix/reference/rix_init.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initiate and maintain an isolated, project-specific, and runtime-pure R\nsetup via Nix. — rix_init","text":"project_path Character folder path isolated nix-R project. Defaults \".\", current working directory path. folder exist yet, created. rprofile_action Character. Action take .Rprofile file destined project_path folder. Possible values include \"create_missing\", writes .Rprofile yet exist (otherwise nothing); \"create_backup\", copies existing .Rprofile new backup file, generating names POSIXct-derived strings include time zone information. new .Rprofile file written default code rix::rix_init(); \"overwrite\" overwrites .Rprofile file exist; \"append\" appends existing file code tailored isolated Nix-R project setup. message_type Character. Message type, defaults \"simple\", gives minimal sufficient feedback. values currently \"verbose\", provides detailed diagnostics.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix_init.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Initiate and maintain an isolated, project-specific, and runtime-pure R\nsetup via Nix. — rix_init","text":"Nothing, function side-effect writing file called \".Rprofile\" specified path.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix_init.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Initiate and maintain an isolated, project-specific, and runtime-pure R\nsetup via Nix. — rix_init","text":"Enhancement computational reproducibility Nix-R environments: primary goal rix::rix_init() enhance computational reproducibility Nix-R environments runtime. Notably, restart required environmental variables set current session, addition writing .Rprofile file. particularly useful make with_nix() evaluate custom R functions \"Nix--Nix\" \"System--Nix\" R setups. introduces two side-effects take effect current later R session setup: Adjusting R_LIBS_USER path: default, first path R_LIBS_USER points user library outside Nix store (see also base::.libPaths()). creates friction potential impurity R packages system's R user library loaded. feature can useful interactively testing R package Nix environment adding .nix configuration, can undesired effects managed carefully. major drawback R packages R_LIBS_USER location need cleaned avoid loading packages outside Nix configuration. Issues, especially macOS, may arise due segmentation faults incompatible linked system libraries. problems can also occur one (reverse) dependencies R package loaded  along process. Make Nix commands available running system commands RStudio: host RStudio session launched via Nix (nix-shell), environmental variables ~/.zshrc ~/.bashrc may inherited. Consequently, Nix command line interfaces like nix-shell might found. .Rprofile code written rix::rix_init() ensures Nix command line programs accessible adding path \"bin\" directory default Nix profile, \"/nix/var/nix/profiles/default/bin\", PATH variable RStudio R session. side effects particularly recommended working flexible R environments, especially users want maintain system's native R setup utilize Nix expressions reproducible development environments. init configuration considered pivotal enhance adoption Nix R community, particularly RStudio Nixpkgs packaged macOS. recommend calling rix::rix_init() prior comparing R code ran two software environments rix::with_nix().","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/reference/rix_init.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Initiate and maintain an isolated, project-specific, and runtime-pure R\nsetup via Nix. — rix_init","text":"","code":"if (FALSE) { # create an isolated, runtime-pure R setup via Nix project_path <- \"./sub_shell\" rix_init(   project_path = project_path,   rprofile_action = \"create_missing\" ) }"},{"path":"https://b-rodrigues.github.io/rix/reference/tar_nix_ga.html","id":null,"dir":"Reference","previous_headings":"","what":"tar_nix_ga Run a {targets}  pipeline on Github Actions. — tar_nix_ga","title":"tar_nix_ga Run a {targets}  pipeline on Github Actions. — tar_nix_ga","text":"tar_nix_ga Run {targets}  pipeline Github Actions.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/tar_nix_ga.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"tar_nix_ga Run a {targets}  pipeline on Github Actions. — tar_nix_ga","text":"","code":"tar_nix_ga()"},{"path":"https://b-rodrigues.github.io/rix/reference/tar_nix_ga.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"tar_nix_ga Run a {targets}  pipeline on Github Actions. — tar_nix_ga","text":"Nothing, copies file diretory.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/tar_nix_ga.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"tar_nix_ga Run a {targets}  pipeline on Github Actions. — tar_nix_ga","text":"function puts .yaml file inside .github/workflows/ folders root project. workflow file use projects default.nix file generate development environment Github Actions run projects {targets} pipeline. Make sure give read write permissions Github Actions bot.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/tar_nix_ga.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"tar_nix_ga Run a {targets}  pipeline on Github Actions. — tar_nix_ga","text":"","code":"if (FALSE) {   tar_nix_ga() }"},{"path":"https://b-rodrigues.github.io/rix/reference/with_nix.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate function in R or shell command via nix-shell environment — with_nix","title":"Evaluate function in R or shell command via nix-shell environment — with_nix","text":"function needs installation Nix. with_nix() two effects run code isolated reproducible environments. Evaluate function R shell command via nix-shell environment (Nix expression custom software libraries; involving pinned versions R R packages via Nixpkgs) error, return result object expr with_nix() current R session.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/with_nix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate function in R or shell command via nix-shell environment — with_nix","text":"","code":"with_nix(   expr,   program = c(\"R\", \"shell\"),   exec_mode = c(\"blocking\", \"non-blocking\"),   project_path = \".\",   nix_file = NULL,   message_type = c(\"simple\", \"verbose\") )"},{"path":"https://b-rodrigues.github.io/rix/reference/with_nix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate function in R or shell command via nix-shell environment — with_nix","text":"expr Single R function call, character vector length one shell command possibly options (flags) command invoked. program = R, can use named anonymous function. function provided expr evaluate pass arguments, hence need wrap function call like function() your_fun(arg_a = \"\", arg_b = \"b\"), avoid evaluation make sure expr function (see details examples). program String stating evaluate expression. Either \"R\", default, \"shell\". = \"R\" evaluate expression via RScript = \"shell\" run system command nix-shell. exec_mode Either \"blocking\" (default) \"non-blocking. either block R session expr running nix-shell environment, oor running background (\"non-blocking\"). program = R yield identical results foreground background evaluation (R object), program = \"shell\" return list exit status, standard output standard error system command text blocking mode. project_path Path folder default.nix file resides. default \".\", working directory current R session. approach also useful different subfolders separate software environments defined different default.nix files. prefer run code custom .nix files directory using with_nix(), can use nix_file argument specify paths .nix files. nix_file Path .nix file contains expressions defining Nix software environment want run expr. See project_path argument alternative way specify environment. message_type String detailed output . Currently, either \"simple\" (default) \"verbose\", shows script runs via nix-shell.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/with_nix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate function in R or shell command via nix-shell environment — with_nix","text":"program = \"R\", R object returned function given expr evaluated via R environment nix-shell defined Nix expression. program = \"shell\", list following elements: status: exit code stdout: character vector standard output stderr: character vector standard error expr command sent command line interface provided Nix package.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/with_nix.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Evaluate function in R or shell command via nix-shell environment — with_nix","text":"with_nix() gives power evaluating main function expr function call stack defined current R session encapsulated nix-R session defined Nix expression (default.nix), located distinct project path (project_path). with_nix() convenient gives direct code feedback read-eval-print-loop style, gives direct interface reproducible infrastructure--code approach offered Nix Nixpkgs. need extra efforts setting DevOps tooling like Docker domain specific tools like {renv} control complex software environments R language. example useful following purposes. test compatibility custom R code software/package dependencies development production environments directly stream outputs (returned objects), messages errors command line tool offered Nixpkgs R session. Test evolving R packages change behavior given unchanged R code, whether give identical results . with_nix() can evaluate R code nix-R session within another nix-R session, also host R session (.e., macOS Linux) within specific nix-R session. feature useful testing reproducibility compatibility given code across different software environments. testing different sets environments necessary, can easily providing Nix expressions custom .nix default.nix files different subfolders project. recommended use rix_init() generate custom .Rprofile file subshell project_dir. defaults file ensure R packages Nix store, defined subshell .nix file loaded system's libraries excluded. job, with_nix() heavily relies patterns manipulate language expressions (aka computing language) offered base R well {codetools} package Luke Tierney. key steps done behind scene: recursively find, classify, export global objects (globals) call stack expr well propagate R package environments found. Serialize (save disk) deserialize (read disk) dependent data structures .Rds necessary function arguments provided, relevant globals call stack, packages, expr outputs returned temporary directory. Use pure nix-shell environments execute R code script reconstructed catching expressions quoting; launched commands like via {sys} Jeroen Ooms: nix-shell --pure --run \"Rscript --vanilla\".","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/with_nix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate function in R or shell command via nix-shell environment — with_nix","text":"","code":"if (FALSE) { # create an isolated, runtime-pure R setup via Nix project_path <- \"./sub_shell\" rix_init(   project_path = project_path,   rprofile_action = \"create_missing\" ) # generate nix environment in `default.nix` rix(   r_ver = \"4.2.0\",   project_path = project_path ) # evaluate function in Nix-R environment via `nix-shell` and `Rscript`, # stream messages, and bring output back to current R session out <- with_nix(   expr = function(mtcars) nrow(mtcars),   program = \"R\", exec_mode = \"non-blocking\", project_path = project_path,   message_type = \"simple\" )  # There no limit in the complexity of function call stacks that `with_nix()` # can possibly handle; however, `expr` should not evaluate and  # needs to be a function for `program = \"R\"`. If you want to pass the # a function with arguments, you can do like this get_sample <- function(seed, n) {   set.seed(seed)   out <- sample(seq(1, 10), n)   return(out) }  out <- with_nix(   expr = get_sample(seed = 1234, n = 5),   program = \"R\", exec_mode = \"non-blocking\",   project_path = \".\",   message_type = \"simple\" )  ## You can also attach packages with `library()` calls in the current R  ## session, which will be exported to the nix-R session. ## Other option: running system commands through `nix-shell` environment. }"},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"new-features-0-6-0","dir":"Changelog","previous_headings":"","what":"New features","title":"rix 0.6.0 (2024-02-02)","text":"added nix_file argument alternative project_path. Specify *.nix fle defining Nix software environment want run expr. macOS: made compatible system’s RStudio version macOS, R session can (yet) started shell launched Dock. Now /nix/var/nix/profiles/default/bin added PATH variable with_nix() called. macOS: made compatible system’s RStudio version macOS, R session can (yet) started shell launched Dock. Now /nix/var/nix/profiles/default/bin added PATH variable with_nix() called. added nix_file argument specify specific .nix file","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"user-facing-changes-0-6-0","dir":"Changelog","previous_headings":"","what":"User facing changes","title":"rix 0.6.0 (2024-02-02)","text":"shell_hook = NULL becomes new default; = \"R --vanilla\". new default ensures with_nix() applied specific project_path directory containing custom .Rprofile file generated rix_init(), together default.nix expression file, can read profile file effectively enforce run-time pure R libraries (Nix store).","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-6-0","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.6.0 (2024-02-02)","text":"avoided empty file artefact checking presence nix-build binary. internal helper now uses Sys.(\"nix-build\") checking availability PATH R session. added another guardrail run-time purity Nixpkgs R removing R_LIBS_USER path .libPaths(). Now cleans itermediary output artefacts (files) written Nix shell (nix-shell) session environment exiting. file artefacts now written subdirectory with_nix tempdir() current R session files deleted. Now, expr errors Nix shell evaluation (.e. custom R function), previous successful run different expr /R global environment state success _out.Rds produced, current session fails bring output current R session. code run Nix-R session defined project_path, now attemps record sessionInfo() try. found failures command older R versions Nixpkgs macOS (.e., aarch64-darwin). Fix segmentation faults tests temporarily setting LD_LIBRARY_PATH. Patched import glibcLocalesUtf8 gibcLocales (imports locales). necessary support Nixpkgs R versions <= 4.2.0, glibcLocalsUtf8 derivation yet available. sacrifice reproducibility rather larger total sizes derivations involved subshell (around 200MB extra).","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"quality-and-unit-testing-0-6-0","dir":"Changelog","previous_headings":"","what":"Quality and unit testing","title":"rix 0.6.0 (2024-02-02)","text":"added test suite 17 unit tests using {testthat} Add GitHub actions runners repository use system’s R Nix R environments configured Nix.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"internal-refactoring-0-6-0","dir":"Changelog","previous_headings":"","what":"Internal refactoring","title":"rix 0.6.0 (2024-02-02)","text":"nix_build(): consistently separate cmd args nix-build system","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-0519000-2024-01-17","dir":"Changelog","previous_headings":"","what":"rix 0.5.1.9000 (2024-01-17)","title":"rix 0.5.1.9000 (2024-01-17)","text":"Added rix::init() initialize maintain isolated, project-specific, pure R setup via Nix. accomplishes writing custom .Rprofile guarantees R packages can attached Nix paths, preventing unnoticed loading system’s R user library (R_LIBS_USER ensuring runtime purity regarding packages linked libraries). Additionally, appends /nix/var/nix/profiles/default/bin PATH. Currently, modification takes effect current R session new R sessions RStudio MacOS. default R session started shell. PATH modified RStudio starting R session, effectively loading local .Rprofile. Future versions RStudio hopefully respect environmental variables shell environment.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-5-1","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.5.1 (2024-01-16)","text":"rix::rix(): patch nixpkgs revisions corresponding R (r_ver) <= 4.2.0; nix-build failed attribute glibcLocalesUtf8 found. Fixed importing gibcLocales. Thanks @motorlearner reporting.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"features-0-5-0","dir":"Changelog","previous_headings":"","what":"Features","title":"rix 0.5.0 (2024-01-07)","text":"Added with_nix(), can evaluate function R shell command via nix-shell environment, return output current R session. works evaluating R code nix-R session within nix-R session, also host R session (.e., macOS linux) within specific nix-R session. feature useful test dependencies specific setups software controlled environments. Added tar_nix_ga(), function run targets pipelines Github Actions using Nix expression.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-4-1","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.4.1 (2023-10-06)","text":"rix::rix(): fix missing pkgs.mkShell shell_hook = NULL. shell_hook = \"\" shell_hook = NULL now producing valid nix expressions.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"features-0-4-0","dir":"Changelog","previous_headings":"","what":"Features","title":"rix 0.4.0 (2023-09-26)","text":"rix::rix() now defaults \"en_US.UTF-8\" relevant locale variables (LANG, LC_ALL, LC_TIME, LC_MONETARY, LC_PAPER, LC_MEASUREMENT) sets environment variables Nix shell. correctly propagated Nix R session. Users can modify locale setting via options(rix.nix_locale_variables = list(LANG = \"de_CH.UTF-8\", <...>), e.g., needs UTF-8 locale. import glibcLocalesUtf8 subset, keep size reasonable.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-4-0","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.4.0 (2023-09-26)","text":"fix locale warnings starting R linux, uses glibc (closes #50). Now, use glibcLocalesUtf8 Nix “x86_64-linux”.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"chore-0-3-1","dir":"Changelog","previous_headings":"","what":"Chore","title":"rix 0.3.1 (2023-09-11)","text":"Remove boilerplate code rix::rix(tex_pkgs = NULL)","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-030-2023-09-10","dir":"Changelog","previous_headings":"","what":"rix 0.3.0 (2023-09-10)","title":"rix 0.3.0 (2023-09-10)","text":"Added support installing TeX Live packages via new rix::rix() argument tex_pkgs.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"chore-0-3-0","dir":"Changelog","previous_headings":"","what":"Chore","title":"rix 0.3.0 (2023-09-10)","text":"update inst/extdata/default.nix installs {rix} v0.3.0.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-0219002-2023-09-02","dir":"Changelog","previous_headings":"","what":"rix 0.2.1.9002 (2023-09-02)","title":"rix 0.2.1.9002 (2023-09-02)","text":"nix_build() now supports --max_jobs flag nix-build via options(rix.nix_build_max_jobs = ). Custom settings option can useful leveraging full /O latency efficient builds shared memory multiprocessing systems.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-0219001-2023-08-29","dir":"Changelog","previous_headings":"","what":"rix 0.2.1.9001 (2023-08-29)","title":"rix 0.2.1.9001 (2023-08-29)","text":"Include nix_build() interactive use vignette (#68).","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"chore-0-2-1-9000","dir":"Changelog","previous_headings":"","what":"Chore","title":"rix 0.2.1.9000 (2023-08-29)","text":"Fix internal create_default_nix() project_path directory name. Updated inst/extdata/default.nix latest commit {rix} prior bumping.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-2-1","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.2.1 (2023-08-26)","text":"Patch rix() allow empty r_pkgs (##67). Patch rix() bug-free calling rix_build() within default nix shell.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"chore-0-2-1","dir":"Changelog","previous_headings":"","what":"Chore","title":"rix 0.2.1 (2023-08-26)","text":"New internal helper create_default_nix() bootstrap ./inst/extdata/default.nix","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"new-features-0-2-0","dir":"Changelog","previous_headings":"","what":"New features","title":"rix 0.2.0 (2023-08-25)","text":"Updated Nix historical revision data include R version 4.3.1. Provision new shell_hook arg rix::rix(), create shellHook entry default.nix.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-2-0","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.2.0 (2023-08-25)","text":"inst/extdata/default.nix: use R --vanilla shellHook propagate user-specific .Renviron .Rprofile. Fixes #56","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-1-2","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.1.2 (2023-08-14)","text":"Patch inst/exdata/default.nix LOCALE_ARCHIVE shellHook set glibc locale fail MacOS anymore (#40; fixed 37f7ab8). nix_build(): fix defensive check error message referring project_path instead nix_file. patch change correct behavior nix_build(), hence cosmetic nature.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-1-1","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.1.1 (2023-08-11)","text":"nix_build() now correctly checks presence nix-build. (4be69b2)","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"new-features-0-1-0","dir":"Changelog","previous_headings":"","what":"New features","title":"rix 0.1.0 (2023-08-11)","text":"Added nix_build() helper runs nix-build interactively R. (#22) rix() now supports installing packages GitHub CRAN archives. rix() now supports using nixpkgs revision instead R version reproducibility Generated default.nix files now also include call made generate top-level comment.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"changes-0-1-0","dir":"Changelog","previous_headings":"","what":"Changes","title":"rix 0.1.0 (2023-08-11)","text":"path argument rix() changed project_path.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-development-version","dir":"Changelog","previous_headings":"","what":"rix (development version)","title":"rix (development version)","text":"Basic functionality added.","code":""}]
+[{"path":"https://b-rodrigues.github.io/rix/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing","title":"Contributing","text":"package developed using fusen package. want contribute, please edit .Rmd files found dev/ folder. , inflate package using fusen::inflate_all(). errors found (warning notes OK), commit open PR. learn use fusen (don’t worry, ’s super easy), refer vignette. development workflow, use semantic versioning via {fledge}.","code":""},{"path":"https://b-rodrigues.github.io/rix/CONTRIBUTING.html","id":"discussions","dir":"","previous_headings":"","what":"Discussions","title":"Contributing","text":"general discussion package, open discussion https://github.com/b-rodrigues/rix/discussions. submit bug reports request features, open issue https://github.com/b-rodrigues/issues.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"GNU General Public License","title":"GNU General Public License","text":"Version 3, 29 June 2007Copyright © 2007 Free Software Foundation, Inc.  Everyone permitted copy distribute verbatim copies license document, changing allowed.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"preamble","dir":"","previous_headings":"","what":"Preamble","title":"GNU General Public License","text":"GNU General Public License free, copyleft license software kinds works. licenses software practical works designed take away freedom share change works. contrast, GNU General Public License intended guarantee freedom share change versions program–make sure remains free software users. , Free Software Foundation, use GNU General Public License software; applies also work released way authors. can apply programs, . speak free software, referring freedom, price. General Public Licenses designed make sure freedom distribute copies free software (charge wish), receive source code can get want , can change software use pieces new free programs, know can things. protect rights, need prevent others denying rights asking surrender rights. Therefore, certain responsibilities distribute copies software, modify : responsibilities respect freedom others. example, distribute copies program, whether gratis fee, must pass recipients freedoms received. must make sure , , receive can get source code. must show terms know rights. Developers use GNU GPL protect rights two steps: (1) assert copyright software, (2) offer License giving legal permission copy, distribute /modify . developers’ authors’ protection, GPL clearly explains warranty free software. users’ authors’ sake, GPL requires modified versions marked changed, problems attributed erroneously authors previous versions. devices designed deny users access install run modified versions software inside , although manufacturer can . fundamentally incompatible aim protecting users’ freedom change software. systematic pattern abuse occurs area products individuals use, precisely unacceptable. Therefore, designed version GPL prohibit practice products. problems arise substantially domains, stand ready extend provision domains future versions GPL, needed protect freedom users. Finally, every program threatened constantly software patents. States allow patents restrict development use software general-purpose computers, , wish avoid special danger patents applied free program make effectively proprietary. prevent , GPL assures patents used render program non-free. precise terms conditions copying, distribution modification follow.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_0-definitions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"0. Definitions","title":"GNU General Public License","text":"“License” refers version 3 GNU General Public License. “Copyright” also means copyright-like laws apply kinds works, semiconductor masks. “Program” refers copyrightable work licensed License. licensee addressed “”. “Licensees” “recipients” may individuals organizations. “modify” work means copy adapt part work fashion requiring copyright permission, making exact copy. resulting work called “modified version” earlier work work “based ” earlier work. “covered work” means either unmodified Program work based Program. “propagate” work means anything , without permission, make directly secondarily liable infringement applicable copyright law, except executing computer modifying private copy. Propagation includes copying, distribution (without modification), making available public, countries activities well. “convey” work means kind propagation enables parties make receive copies. Mere interaction user computer network, transfer copy, conveying. interactive user interface displays “Appropriate Legal Notices” extent includes convenient prominently visible feature (1) displays appropriate copyright notice, (2) tells user warranty work (except extent warranties provided), licensees may convey work License, view copy License. interface presents list user commands options, menu, prominent item list meets criterion.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_1-source-code","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"1. Source Code","title":"GNU General Public License","text":"“source code” work means preferred form work making modifications . “Object code” means non-source form work. “Standard Interface” means interface either official standard defined recognized standards body, , case interfaces specified particular programming language, one widely used among developers working language. “System Libraries” executable work include anything, work whole, () included normal form packaging Major Component, part Major Component, (b) serves enable use work Major Component, implement Standard Interface implementation available public source code form. “Major Component”, context, means major essential component (kernel, window system, ) specific operating system () executable work runs, compiler used produce work, object code interpreter used run . “Corresponding Source” work object code form means source code needed generate, install, (executable work) run object code modify work, including scripts control activities. However, include work’s System Libraries, general-purpose tools generally available free programs used unmodified performing activities part work. example, Corresponding Source includes interface definition files associated source files work, source code shared libraries dynamically linked subprograms work specifically designed require, intimate data communication control flow subprograms parts work. Corresponding Source need include anything users can regenerate automatically parts Corresponding Source. Corresponding Source work source code form work.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_2-basic-permissions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"2. Basic Permissions","title":"GNU General Public License","text":"rights granted License granted term copyright Program, irrevocable provided stated conditions met. License explicitly affirms unlimited permission run unmodified Program. output running covered work covered License output, given content, constitutes covered work. License acknowledges rights fair use equivalent, provided copyright law. may make, run propagate covered works convey, without conditions long license otherwise remains force. may convey covered works others sole purpose make modifications exclusively , provide facilities running works, provided comply terms License conveying material control copyright. thus making running covered works must exclusively behalf, direction control, terms prohibit making copies copyrighted material outside relationship . Conveying circumstances permitted solely conditions stated . Sublicensing allowed; section 10 makes unnecessary.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_3-protecting-users-legal-rights-from-anti-circumvention-law","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"3. Protecting Users’ Legal Rights From Anti-Circumvention Law","title":"GNU General Public License","text":"covered work shall deemed part effective technological measure applicable law fulfilling obligations article 11 WIPO copyright treaty adopted 20 December 1996, similar laws prohibiting restricting circumvention measures. convey covered work, waive legal power forbid circumvention technological measures extent circumvention effected exercising rights License respect covered work, disclaim intention limit operation modification work means enforcing, work’s users, third parties’ legal rights forbid circumvention technological measures.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_4-conveying-verbatim-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"4. Conveying Verbatim Copies","title":"GNU General Public License","text":"may convey verbatim copies Program’s source code receive , medium, provided conspicuously appropriately publish copy appropriate copyright notice; keep intact notices stating License non-permissive terms added accord section 7 apply code; keep intact notices absence warranty; give recipients copy License along Program. may charge price price copy convey, may offer support warranty protection fee.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_5-conveying-modified-source-versions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"5. Conveying Modified Source Versions","title":"GNU General Public License","text":"may convey work based Program, modifications produce Program, form source code terms section 4, provided also meet conditions: ) work must carry prominent notices stating modified , giving relevant date. b) work must carry prominent notices stating released License conditions added section 7. requirement modifies requirement section 4 “keep intact notices”. c) must license entire work, whole, License anyone comes possession copy. License therefore apply, along applicable section 7 additional terms, whole work, parts, regardless packaged. License gives permission license work way, invalidate permission separately received . d) work interactive user interfaces, must display Appropriate Legal Notices; however, Program interactive interfaces display Appropriate Legal Notices, work need make . compilation covered work separate independent works, nature extensions covered work, combined form larger program, volume storage distribution medium, called “aggregate” compilation resulting copyright used limit access legal rights compilation’s users beyond individual works permit. Inclusion covered work aggregate cause License apply parts aggregate.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_6-conveying-non-source-forms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"6. Conveying Non-Source Forms","title":"GNU General Public License","text":"may convey covered work object code form terms sections 4 5, provided also convey machine-readable Corresponding Source terms License, one ways: ) Convey object code , embodied , physical product (including physical distribution medium), accompanied Corresponding Source fixed durable physical medium customarily used software interchange. b) Convey object code , embodied , physical product (including physical distribution medium), accompanied written offer, valid least three years valid long offer spare parts customer support product model, give anyone possesses object code either (1) copy Corresponding Source software product covered License, durable physical medium customarily used software interchange, price reasonable cost physically performing conveying source, (2) access copy Corresponding Source network server charge. c) Convey individual copies object code copy written offer provide Corresponding Source. alternative allowed occasionally noncommercially, received object code offer, accord subsection 6b. d) Convey object code offering access designated place (gratis charge), offer equivalent access Corresponding Source way place charge. need require recipients copy Corresponding Source along object code. place copy object code network server, Corresponding Source may different server (operated third party) supports equivalent copying facilities, provided maintain clear directions next object code saying find Corresponding Source. Regardless server hosts Corresponding Source, remain obligated ensure available long needed satisfy requirements. e) Convey object code using peer--peer transmission, provided inform peers object code Corresponding Source work offered general public charge subsection 6d. separable portion object code, whose source code excluded Corresponding Source System Library, need included conveying object code work. “User Product” either (1) “consumer product”, means tangible personal property normally used personal, family, household purposes, (2) anything designed sold incorporation dwelling. determining whether product consumer product, doubtful cases shall resolved favor coverage. particular product received particular user, “normally used” refers typical common use class product, regardless status particular user way particular user actually uses, expects expected use, product. product consumer product regardless whether product substantial commercial, industrial non-consumer uses, unless uses represent significant mode use product. “Installation Information” User Product means methods, procedures, authorization keys, information required install execute modified versions covered work User Product modified version Corresponding Source. information must suffice ensure continued functioning modified object code case prevented interfered solely modification made. convey object code work section , , specifically use , User Product, conveying occurs part transaction right possession use User Product transferred recipient perpetuity fixed term (regardless transaction characterized), Corresponding Source conveyed section must accompanied Installation Information. requirement apply neither third party retains ability install modified object code User Product (example, work installed ROM). requirement provide Installation Information include requirement continue provide support service, warranty, updates work modified installed recipient, User Product modified installed. Access network may denied modification materially adversely affects operation network violates rules protocols communication across network. Corresponding Source conveyed, Installation Information provided, accord section must format publicly documented (implementation available public source code form), must require special password key unpacking, reading copying.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_7-additional-terms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"7. Additional Terms","title":"GNU General Public License","text":"“Additional permissions” terms supplement terms License making exceptions one conditions. Additional permissions applicable entire Program shall treated though included License, extent valid applicable law. additional permissions apply part Program, part may used separately permissions, entire Program remains governed License without regard additional permissions. convey copy covered work, may option remove additional permissions copy, part . (Additional permissions may written require removal certain cases modify work.) may place additional permissions material, added covered work, can give appropriate copyright permission. Notwithstanding provision License, material add covered work, may (authorized copyright holders material) supplement terms License terms: ) Disclaiming warranty limiting liability differently terms sections 15 16 License; b) Requiring preservation specified reasonable legal notices author attributions material Appropriate Legal Notices displayed works containing ; c) Prohibiting misrepresentation origin material, requiring modified versions material marked reasonable ways different original version; d) Limiting use publicity purposes names licensors authors material; e) Declining grant rights trademark law use trade names, trademarks, service marks; f) Requiring indemnification licensors authors material anyone conveys material (modified versions ) contractual assumptions liability recipient, liability contractual assumptions directly impose licensors authors. non-permissive additional terms considered “restrictions” within meaning section 10. Program received , part , contains notice stating governed License along term restriction, may remove term. license document contains restriction permits relicensing conveying License, may add covered work material governed terms license document, provided restriction survive relicensing conveying. add terms covered work accord section, must place, relevant source files, statement additional terms apply files, notice indicating find applicable terms. Additional terms, permissive non-permissive, may stated form separately written license, stated exceptions; requirements apply either way.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_8-termination","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"8. Termination","title":"GNU General Public License","text":"may propagate modify covered work except expressly provided License. attempt otherwise propagate modify void, automatically terminate rights License (including patent licenses granted third paragraph section 11). However, cease violation License, license particular copyright holder reinstated () provisionally, unless copyright holder explicitly finally terminates license, (b) permanently, copyright holder fails notify violation reasonable means prior 60 days cessation. Moreover, license particular copyright holder reinstated permanently copyright holder notifies violation reasonable means, first time received notice violation License (work) copyright holder, cure violation prior 30 days receipt notice. Termination rights section terminate licenses parties received copies rights License. rights terminated permanently reinstated, qualify receive new licenses material section 10.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_9-acceptance-not-required-for-having-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"9. Acceptance Not Required for Having Copies","title":"GNU General Public License","text":"required accept License order receive run copy Program. Ancillary propagation covered work occurring solely consequence using peer--peer transmission receive copy likewise require acceptance. However, nothing License grants permission propagate modify covered work. actions infringe copyright accept License. Therefore, modifying propagating covered work, indicate acceptance License .","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_10-automatic-licensing-of-downstream-recipients","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"10. Automatic Licensing of Downstream Recipients","title":"GNU General Public License","text":"time convey covered work, recipient automatically receives license original licensors, run, modify propagate work, subject License. responsible enforcing compliance third parties License. “entity transaction” transaction transferring control organization, substantially assets one, subdividing organization, merging organizations. propagation covered work results entity transaction, party transaction receives copy work also receives whatever licenses work party’s predecessor interest give previous paragraph, plus right possession Corresponding Source work predecessor interest, predecessor can get reasonable efforts. may impose restrictions exercise rights granted affirmed License. example, may impose license fee, royalty, charge exercise rights granted License, may initiate litigation (including cross-claim counterclaim lawsuit) alleging patent claim infringed making, using, selling, offering sale, importing Program portion .","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_11-patents","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"11. Patents","title":"GNU General Public License","text":"“contributor” copyright holder authorizes use License Program work Program based. work thus licensed called contributor’s “contributor version”. contributor’s “essential patent claims” patent claims owned controlled contributor, whether already acquired hereafter acquired, infringed manner, permitted License, making, using, selling contributor version, include claims infringed consequence modification contributor version. purposes definition, “control” includes right grant patent sublicenses manner consistent requirements License. contributor grants non-exclusive, worldwide, royalty-free patent license contributor’s essential patent claims, make, use, sell, offer sale, import otherwise run, modify propagate contents contributor version. following three paragraphs, “patent license” express agreement commitment, however denominated, enforce patent (express permission practice patent covenant sue patent infringement). “grant” patent license party means make agreement commitment enforce patent party. convey covered work, knowingly relying patent license, Corresponding Source work available anyone copy, free charge terms License, publicly available network server readily accessible means, must either (1) cause Corresponding Source available, (2) arrange deprive benefit patent license particular work, (3) arrange, manner consistent requirements License, extend patent license downstream recipients. “Knowingly relying” means actual knowledge , patent license, conveying covered work country, recipient’s use covered work country, infringe one identifiable patents country reason believe valid. , pursuant connection single transaction arrangement, convey, propagate procuring conveyance , covered work, grant patent license parties receiving covered work authorizing use, propagate, modify convey specific copy covered work, patent license grant automatically extended recipients covered work works based . patent license “discriminatory” include within scope coverage, prohibits exercise , conditioned non-exercise one rights specifically granted License. may convey covered work party arrangement third party business distributing software, make payment third party based extent activity conveying work, third party grants, parties receive covered work , discriminatory patent license () connection copies covered work conveyed (copies made copies), (b) primarily connection specific products compilations contain covered work, unless entered arrangement, patent license granted, prior 28 March 2007. Nothing License shall construed excluding limiting implied license defenses infringement may otherwise available applicable patent law.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_12-no-surrender-of-others-freedom","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"12. No Surrender of Others’ Freedom","title":"GNU General Public License","text":"conditions imposed (whether court order, agreement otherwise) contradict conditions License, excuse conditions License. convey covered work satisfy simultaneously obligations License pertinent obligations, consequence may convey . example, agree terms obligate collect royalty conveying convey Program, way satisfy terms License refrain entirely conveying Program.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_13-use-with-the-gnu-affero-general-public-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"13. Use with the GNU Affero General Public License","title":"GNU General Public License","text":"Notwithstanding provision License, permission link combine covered work work licensed version 3 GNU Affero General Public License single combined work, convey resulting work. terms License continue apply part covered work, special requirements GNU Affero General Public License, section 13, concerning interaction network apply combination .","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_14-revised-versions-of-this-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"14. Revised Versions of this License","title":"GNU General Public License","text":"Free Software Foundation may publish revised /new versions GNU General Public License time time. new versions similar spirit present version, may differ detail address new problems concerns. version given distinguishing version number. Program specifies certain numbered version GNU General Public License “later version” applies , option following terms conditions either numbered version later version published Free Software Foundation. Program specify version number GNU General Public License, may choose version ever published Free Software Foundation. Program specifies proxy can decide future versions GNU General Public License can used, proxy’s public statement acceptance version permanently authorizes choose version Program. Later license versions may give additional different permissions. However, additional obligations imposed author copyright holder result choosing follow later version.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_15-disclaimer-of-warranty","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"15. Disclaimer of Warranty","title":"GNU General Public License","text":"WARRANTY PROGRAM, EXTENT PERMITTED APPLICABLE LAW. EXCEPT OTHERWISE STATED WRITING COPYRIGHT HOLDERS /PARTIES PROVIDE PROGRAM “” WITHOUT WARRANTY KIND, EITHER EXPRESSED IMPLIED, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM . PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_16-limitation-of-liability","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"16. Limitation of Liability","title":"GNU General Public License","text":"EVENT UNLESS REQUIRED APPLICABLE LAW AGREED WRITING COPYRIGHT HOLDER, PARTY MODIFIES /CONVEYS PROGRAM PERMITTED , LIABLE DAMAGES, INCLUDING GENERAL, SPECIAL, INCIDENTAL CONSEQUENTIAL DAMAGES ARISING USE INABILITY USE PROGRAM (INCLUDING LIMITED LOSS DATA DATA RENDERED INACCURATE LOSSES SUSTAINED THIRD PARTIES FAILURE PROGRAM OPERATE PROGRAMS), EVEN HOLDER PARTY ADVISED POSSIBILITY DAMAGES.","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"id_17-interpretation-of-sections-15-and-16","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"17. Interpretation of Sections 15 and 16","title":"GNU General Public License","text":"disclaimer warranty limitation liability provided given local legal effect according terms, reviewing courts shall apply local law closely approximates absolute waiver civil liability connection Program, unless warranty assumption liability accompanies copy Program return fee. END TERMS CONDITIONS","code":""},{"path":"https://b-rodrigues.github.io/rix/LICENSE.html","id":"how-to-apply-these-terms-to-your-new-programs","dir":"","previous_headings":"","what":"How to Apply These Terms to Your New Programs","title":"GNU General Public License","text":"develop new program, want greatest possible use public, best way achieve make free software everyone can redistribute change terms. , attach following notices program. safest attach start source file effectively state exclusion warranty; file least “copyright” line pointer full notice found. Also add information contact electronic paper mail. program terminal interaction, make output short notice like starts interactive mode: hypothetical commands show w show c show appropriate parts General Public License. course, program’s commands might different; GUI interface, use “box”. also get employer (work programmer) school, , sign “copyright disclaimer” program, necessary. information , apply follow GNU GPL, see . GNU General Public License permit incorporating program proprietary programs. program subroutine library, may consider useful permit linking proprietary applications library. want , use GNU Lesser General Public License instead License. first, please read .","code":" Copyright (C)     This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.  You should have received a copy of the GNU General Public License along with this program.  If not, see .   Copyright (C)    This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details."},{"path":"https://b-rodrigues.github.io/rix/articles/a-getting-started.html","id":"the-nix-package-manager","dir":"Articles","previous_headings":"","what":"The Nix package manager","title":"a - Getting started","text":"Nix package manager can installed computer (regardless OS) can used install software like package manager. ’re familiar Ubuntu Linux distribution, likely used apt-get install software. macOS, may used homebrew similar purposes. Nix functions similar way, many advantages classic package managers. main advantage Nix, least purposes, repository software huge. writing, contains 80.000 packages, entirety CRAN Bioconductor available Nix’s repositories. means using Nix, possible install R, also packages required project. obvious question use Nix instead simply installing R R packages usual. answer Nix makes sure install every dependency package, required system libraries. example, xlsx package requires Java programming language installed computer successfully install. can difficult achieve, xlsx bullied many R developers throughout years (especially using Linux distribution, sudo R CMD javareconf still plagues nightmares). Nix, suffices declare want xlsx package project, Nix figures automatically Java required installs configures . just happens without required intervention user. second advantage Nix possible pin certain revision Nix packages’ repository (called nixpkgs) project. Pinning revision ensures every package Nix installs always exactly versions, regardless future packages get installed.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/a-getting-started.html","id":"rix-workflow","dir":"Articles","previous_headings":"","what":"rix workflow","title":"a - Getting started","text":"idea rix declare environment need using provided rix() function. rix() package’s main function generates file called default.nix used Nix package manager build environment. Ideally, set environment projects. can use environment either work interactively, run R scripts. possible many environments projects, software common environments simply re-used get re-installed save space. Environments isolated , can still interact system’s files, unlike Docker volume must mounted. Environments can also interact software installed computer usual means, can sometimes lead issues. provided functions documentation avoid , take time read vignettes fine. rix() several arguments: R version need project; list R packages project needs; optional list additional software (example Python interpreter, Quarto); optional list packages install Github; optional list LaTeX packages; whether want use RStudio IDE project (VS Code, another environment); path save default.nix file (default current working directory) example: call writes default.nix file current working directory. default.nix can turn used Nix build environment containing latest version R, dplyr {chronicler} packages. Take note ide = \"\" argument: argument, values can take, discussed vignette vignette(\"e-interactive-use\") continue reading vignette vignettes numbered “d”.","code":"rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"chronicler\"),     ide = \"other\")"},{"path":"https://b-rodrigues.github.io/rix/articles/a-getting-started.html","id":"using-default-nix-files","dir":"Articles","previous_headings":"rix workflow","what":"Using default.nix files","title":"a - Getting started","text":"Nix package manager can used build reproducible development environments according specifications found generated default.nix files, contain Nix expression. expression Nix jargon function multiple inputs one output, output development environment. rix require Nix installed generate valid expressions (require internet connection), generate expressions use machines. actually build environment using default.nix file, go chose write (ideally new, empty folder root folder project) use Nix package manager build environment. Call following function terminal: Nix done building environment, can start working interactively using following command terminal emulator (R console): drop Nix shell provides installed software. Now know Nix rix, time get tools installed system. ’re running either Linux Windows, read Linux Windows vignette: vignette(\"b1-setting---using-rix--linux--windows\") ’re running macOS, read macOS vignette: vignette(\"b2-setting---using-rix--macos\")","code":"nix-build nix-shell"},{"path":"https://b-rodrigues.github.io/rix/articles/b1-setting-up-and-using-rix-on-linux-and-windows.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"b1 - Setting up and using rix on Linux and Windows","text":"comes Nix, really two supported operating systems: macOS Linux distributions. Windows “supported” actually running Linux thanks WSL2. practice means Linux distributions Windows can considered one system, macOS another, separate, system. Windows really running Linux hood thanks WSL2, means WSL2 needs running Windows system attempt install Nix. important know can run rix even don’t Nix installed, means can generate Nix expressions, just can’t build .","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/b1-setting-up-and-using-rix-on-linux-and-windows.html","id":"windows-pre-requisites","dir":"Articles","previous_headings":"Introduction","what":"Windows pre-requisites","title":"b1 - Setting up and using rix on Linux and Windows","text":"Windows, need Windows Subsystem Linux 2 (WSL2) run Nix. recent version Windows 10 11, can simply run administrator PowerShell: can find installation notes official MS documentation. recommend activate systemd Ubuntu WSL2, mainly supports users root running Nix. set , please outlined official Ubuntu blog entry: Afterwards, can install Nix like business usual. can proceed Determinate Systems installer.","code":"wsl --install # in WSL2 Ubuntu shell  sudo -i nano /etc/wsl.conf  # add this entry  [boot] systemd=true  # then restart running instance from PowerShell  wsl --shutdown  # relaunch Ubuntu WSL2"},{"path":"https://b-rodrigues.github.io/rix/articles/b1-setting-up-and-using-rix-on-linux-and-windows.html","id":"installing-nix","dir":"Articles","previous_headings":"","what":"Installing Nix","title":"b1 - Setting up and using rix on Linux and Windows","text":"can use rix generate Nix expressions even don’t Nix installed system, obviously, need install Nix actually want build defined development environment use . Installing (uninstalling) Nix quite simple, thanks installer Determinate Systems, company provides services tools built Nix. Simply open terminal run following line (Windows, decided activate systemd, append --init none command. can find details Determinate Nix Installer page): Nix installed, can build expressions generate rix! Linux, Nix installed, software installed Nix saved /nix directory root partition. common Linux users separate partition /, may small. Complete development environments built Nix can take much space, available space root partition limited, advise mount /nix folder another partition space (example, secondary hard drive). , edit /etc/fstab add following line end: map /nix /home/path_to/nix can larger partition. enough space root partition, can ignore instructions.","code":"curl --proto '=https' --tlsv1.2 -sSf \\     -L https://install.determinate.systems/nix | \\      sh -s -- install /home/path_to/nix /nix none bind 0 0"},{"path":"https://b-rodrigues.github.io/rix/articles/b1-setting-up-and-using-rix-on-linux-and-windows.html","id":"what-if-you-dont-have-r-already-installed","dir":"Articles","previous_headings":"","what":"What if you don’t have R already installed?","title":"b1 - Setting up and using rix on Linux and Windows","text":"successfully installed Nix, don’t yet R installed system, install R usually operating system, install rix package, , generated project-specific expressions build . also install R using Nix. Running following line terminal drop interactive R session can use start generating expressions: immediately start R session inside terminal. can now run something like : generate default.nix, use file generate environment R, dplyr ggplot2. need add packages project, rerun command , add needed packages r_pkgs. detailled vignette vignette(\"d1-installing-r-packages---nix-environment\") vignette(\"d2-installing-system-tools--texlive-packages---nix-environment\").","code":"nix-shell --expr \"$(curl -sl https://raw.githubusercontent.com/b-rodrigues/rix/master/inst/extdata/default.nix)\" rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"other\",     project_path = \".\",     overwrite = TRUE)"},{"path":"https://b-rodrigues.github.io/rix/articles/b1-setting-up-and-using-rix-on-linux-and-windows.html","id":"generating-expressions","dir":"Articles","previous_headings":"","what":"Generating expressions","title":"b1 - Setting up and using rix on Linux and Windows","text":"R installed, either usual installer operating system, Nix explained previously, can now start building project-specific development environments. Start R session, install rix ’s already done. rix yet CRAN, easiest way install r-universe: can use rix package generate expressions. Consult next vignette vignette(\"c-using-rix--build-project-specific-environments\") learn .","code":"install.packages(\"rix\", repos = c(\"https://b-rodrigues.r-universe.dev\",   \"https://cloud.r-project.org\"))"},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"b2 - Setting up and using rix on macOS","text":"comes Nix, really two supported operating systems: macOS Linux distributions. Windows “supported” actually running Linux thanks WSL2. practice means Linux distributions Windows can considered one system, macOS another, separate, system, idiosyncrasies. vignette details .","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"installing-nix","dir":"Articles","previous_headings":"","what":"Installing Nix","title":"b2 - Setting up and using rix on macOS","text":"can use rix generate Nix expressions even don’t Nix installed system, obviously, need install Nix actually want build defined development environment use . Installing (uninstalling) Nix quite simple, thanks installer Determinate Systems, company provides services tools built Nix. Simply open terminal run following line: Nix installed, can build expressions generate rix!","code":"curl --proto '=https' --tlsv1.2 -sSf \\     -L https://install.determinate.systems/nix | \\      sh -s -- install"},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"what-if-you-dont-have-r-already-installed","dir":"Articles","previous_headings":"","what":"What if you don’t have R already installed?","title":"b2 - Setting up and using rix on macOS","text":"successfully installed Nix, don’t yet R installed system, install R usually operating system, install rix package, , generated project-specific expressions build . also install R using Nix. Running following line terminal drop interactive R session can use start generating expressions: immediately start R session inside terminal. can now run something like : generate default.nix, use file generate environment R, dplyr ggplot2. need add packages project, rerun command , add needed packages r_pkgs. detailed vignettes vignette(\"d1-installing-r-packages---nix-environment\") vignette(\"d2-installing-system-tools--texlive-packages---nix-environment\").","code":"nix-shell --expr \"$(curl -sl https://raw.githubusercontent.com/b-rodrigues/rix/master/inst/extdata/default.nix)\" rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"other\",     project_path = \".\",     overwrite = TRUE)"},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"generating-expressions","dir":"Articles","previous_headings":"","what":"Generating expressions","title":"b2 - Setting up and using rix on macOS","text":"R installed, either usual installer operating system, Nix explained previously, can now start building project-specific development environments. macOS, generating expressions works just like Linux Windows. Start R session, install rix ’s already done. rix yet CRAN, easiest way install r-universe: can use rix package generate expressions. Consult next vignette vignette(\"c-using-rix--build-project-specific-environments\") learn .","code":"install.packages(\"rix\", repos = c(\"https://b-rodrigues.r-universe.dev\",   \"https://cloud.r-project.org\"))"},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"r-support-for-apple-silicon-in-nixpkgs","dir":"Articles","previous_headings":"More macOS specificities","what":"R Support for Apple Silicon in Nixpkgs","title":"b2 - Setting up and using rix on macOS","text":"Nixpkgs, M series processors ARM64 family, also known AArch64, supports R since R version 3.5.3. Earlier versions R compile modern Apple processor architectures corresponding Nixpkgs revisions time. Hence, darwin-aarch64 platform constrained backwards-compatibility.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"shared-libraries-issue","dir":"Articles","previous_headings":"More macOS specificities","what":"Shared libraries issue","title":"b2 - Setting up and using rix on macOS","text":"using environments built Nix macOS, might get crashes (segmentation faults) refering “shared libraries”. indicate user library R packages interfering project-specific Nix environment. system’s user library Nix packaged R default includes appears search paths (check libPaths()). macOS, user library /Library/Frameworks/R.framework/Versions/.-/Resources/library; observed crashes R packages depend system libraries, {data.table} {dplyr}, (reverse) dependencies. user libraries system also appear search path R nixpkgs Linux, think good idea force isolation R packages making behave runtime-pure manner. make happen, recommend set project-specific .Rprofile using rix::rix_init(). way, packages declaratively defined default.nix built part Nix store (one R package one separate derivation listed unique Nix path) appear R library path. example, call rix::rix() like .","code":"# see ?rix_init for more details  rix_init(   project_path = \"./rix_darwin\",   rprofile_action = \"create_missing\" )"},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"rstudio-and-other-development-interfaces-on-macos","dir":"Articles","previous_headings":"More macOS specificities","what":"RStudio and other development interfaces on macOS","title":"b2 - Setting up and using rix on macOS","text":"writing, RStudio installed nixpkgs macOS, wish use RStudio Nix environment, install nixpkgs. means impossible use RStudio Nix environment macOS. try generate expression ide = \"rstudio\" macOS, raise warning. options : ignore warning, environment built Linux distribution (even though generated expression macOS) used Linux distribution; change ide = argument either \"\" \"code\". Use \"code\" want use VS Code \"\" editor, like Vim Emacs. editors don’t need installed nixpkgs use Nix environments, unlike RStudio; ’re working pipeline targets package, run Github Actions. means work code RStudio outside Nix environment, code executed Github Actions runners. See vignette vignette(\"z-advanced-topic-reproducible-analytical-pipelines--nix\") details; work project usual, using usual installation R RStudio, generate default.nix end ide = \"\" right version R reproducibility purposes; use subshells execute code need run specific environment. See vignette vignette(\"z-advanced-topic-running-r--shell-code--nix--r\"); help us package RStudio macOS nixpgs. See , Nix expression RStudio. recommend continue next vignette tackling advanced topics listed : vignette(\"c-using-rix--build-project-specific-environments\").","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/articles/b2-setting-up-and-using-rix-on-macos.html","id":"path-of-nix-installation-not-in-path","dir":"Articles","previous_headings":"Why do we need all these special tweaks?","what":"Path of Nix installation not in PATH","title":"b2 - Setting up and using rix on macOS","text":"using RStudio Desktop macOS, typically launch Applications folder. However, RStudio currently lacks option start integrated R session via shell startup macOS (see issue RStudio Linux flavors, PATH properly inherited R sessions. result, key environmental variables UNIX systems, like PATH, properly loaded default shell (e.g., zsh, via ~/.zshrc). Also, RStudio overwrites PATH variable set via .Rprofile .Renviron defaults, makes impossible find Nix standard Nix tools like nix-build. ’s worth noting doesn’t impact rix::rix(), generates R expressions doesn’t require Nix installation. workaround, added mechanisms nix_build() with_nix() append path Nix store PATH variable active session automatically (via Sys.setenv(), use RStudio macOS. don’t anything. covered, get friendly message informs . special side effect.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/c-using-rix-to-build-project-specific-environments.html","id":"project-specific-nix-environments","dir":"Articles","previous_headings":"","what":"Project-specific Nix environments","title":"c - Using rix to build project specific environments","text":"Now required software installed, ’s time learn declaring using reproducible inveronments. ideal workflow using rix create new, separate environment start project. Let’s say wish analyse data set, need dplyr ggplot2. Let’s also suppose use VS Code IDE (discussion editors vignette vignette(\"e-interactive-use\") now, let’s assume use VS Code). rix::rix() function, can easily generate right default.nix file. need provide following inputs rix(): r_ver: version R required. Use “latest” latest version; r_pkgs: required R packages. example “dplyr” (vignette vignette(\"d1-installing-r-packages---nix-environment\")); system_pkgs: required system packages, needed. example “quarto”, Python interpreter (vignette vignette(\"d2-installing-system-tools--texlive-packages---nix-environment\")); git_pkgs: list git packages add (vignette vignette(\"d1-installing-r-packages---nix-environment\")); ide: integrated development editor use (vignette vignette(\"e-interactive-use\")) path: path save default.nix file. overwrite: whether overwrite default.nix file . print: whether print default.nix file console . Run following command generate right default.nix file: start using environment, open terminal folder containing default.nix use following Nix command: nix-build Nix command builds environment according specifications found default.nix file. environment done building, find new file called result next default.nix file. file symlink software installed Nix. rix also provides nix_build() function build Nix environments within interactive R session, always guaranteed succeed, due differences platforms. explained detail following vignette vignette(\"z-advanced-topic-running-r--shell-code--nix--r\"). case doubt, run nix-build usual terminal application. now use environment, type terminal : activate environment. VS Code installed can start environment VS Code use specific R version library packages. explore greater detail vignette vignette(\"e-interactive-use\").","code":"path_default_nix <- tempdir()  rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"code\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = \"4008381882569ab4773f2ba0d7b7bbde8f665672\", #> #  > r_pkgs = c(\"dplyr\", #> #  > \"ggplot2\"), #> #  > system_pkgs = NULL, #> #  > git_pkgs = NULL, #> #  > ide = \"code\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE, #> #  > print = TRUE) #> # It uses nixpkgs' revision 4008381882569ab4773f2ba0d7b7bbde8f665672 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/4008381882569ab4773f2ba0d7b7bbde8f665672.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) dplyr ggplot2 languageserver; #> }; #>    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 = [  rpkgs  system_packages  ]; #>        #>   } nix-build nix-shell"},{"path":"https://b-rodrigues.github.io/rix/articles/c-using-rix-to-build-project-specific-environments.html","id":"running-old-projects-with-rix","dir":"Articles","previous_headings":"","what":"Running old projects with {rix}","title":"c - Using rix to build project specific environments","text":"example shows create default.nix instructions build environment R version 4.2.1, dplyr janitor packages specific IDE: file looks like : first line quite important, shows revision nixpkgs used environment. revision commit hash particular release nixpkgs, : 79b3d4bcae8. revision nixpkgs one shipped version 4.2.1 R, dplyr janitor packages get installed versions available revision well. means R versions package versions always coupled using Nix. However, need specific version R, also specific version package available particular Nix revision, one solution install package Github fro CRAN archives. Read vignette vignette(\"d1-installing-r-packages---nix-environment\") know . know versions R available, read documention available_r().","code":"path_default_nix <- tempdir()  rix(r_ver = \"4.2.1\",     r_pkgs = c(\"dplyr\", \"janitor\"),     system_pkgs = c(\"quarto\"),     git_pkgs = NULL,     ide = \"other\",     project_path = path_default_nix,     overwrite = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = \"79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a\", #> #  > r_pkgs = c(\"dplyr\", #> #  > \"janitor\"), #> #  > system_pkgs = c(\"quarto\"), #> #  > git_pkgs = NULL, #> #  > ide = \"other\", #> #  > 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/b-rodrigues/rix #> let #>  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) dplyr janitor; #> }; #>    system_packages = builtins.attrValues { #>   inherit (pkgs) R glibcLocales nix quarto; #> }; #>   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 = [  rpkgs  system_packages  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/c-using-rix-to-build-project-specific-environments.html","id":"running-programs-from-an-environment","dir":"Articles","previous_headings":"","what":"Running programs from an environment","title":"c - Using rix to build project specific environments","text":"create bash script put path make process launching editor environment streamlined. example, project called housing, create script execute start project: execute VS Code environment housing project. use targets execute pipeline environment running:","code":"#!/bin/bash nix-shell /absolute/path/to/housing/default.nix --run code cd /absolute/path/to/housing/ && nix-shell default.nix --run \"Rscript -e 'targets::tar_make()'\""},{"path":"https://b-rodrigues.github.io/rix/articles/c-using-rix-to-build-project-specific-environments.html","id":"running-single-functions-in-a-subshell","dir":"Articles","previous_headings":"","what":"Running single functions in a subshell","title":"c - Using rix to build project specific environments","text":"also possible run single functions isolated environment active R session using with_nix() get output function loaded current session. Refer vignette vignette(\"z-advanced-topic-running-r--shell-code--nix--r\") details achieve . Concretely means running R version 4.3.2 (installed via Nix, ), execute function R version 4.0.0 example subshell (execute function requires old version package subshell), get result computation back main R session.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/c-using-rix-to-build-project-specific-environments.html","id":"nix-environments-are-not-completely-isolated-from-your-system","dir":"Articles","previous_headings":"","what":"Nix environments are not completely isolated from your system","title":"c - Using rix to build project specific environments","text":"important know environment built Nix totally isolated rest system. Suppose program sl installed system, suppose build Nix environment also comes sl. activate environment, version sl run called one included Nix environment. , however, start sl Nix environment come , system’s sl get used instead. also possible completely isolate environment built Nix using provided rix_init() function activate environment using nix-shell --pure instead nix-shell. especially useful subshells.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/d1-installing-r-packages-in-a-nix-environment.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"d1 - Installing R packages in a Nix environment","text":"now know declare build reproducible development environments using rix Nix. vignette explain install specific versions CRAN packages install packages GitHub.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/d1-installing-r-packages-in-a-nix-environment.html","id":"installing-old-packages-archived-on-cran","dir":"Articles","previous_headings":"","what":"Installing old packages archived on CRAN","title":"d1 - Installing R packages in a Nix environment","text":"possible install arbitrary version package archived CRAN: expression install R version 4.2.1, dplyr version 0.8.0 janitor version 1.0.0. can useful, especially packages archived, otherwise, feature ideally used sparingly. want reconstruct environment around 2019, use version R current time. ensure every package gets installed version compatible version R, might case need install old version one particular package.","code":"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 = \"other\",     project_path = path_default_nix,     overwrite = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = \"79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a\", #> #  > r_pkgs = c(\"dplyr@0.8.0\", #> #  > \"janitor@1.0.0\"), #> #  > system_pkgs = NULL, #> #  > git_pkgs = NULL, #> #  > ide = \"other\", #> #  > 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/b-rodrigues/rix #> let #>  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a.tar.gz\") {}; #>   git_archive_pkgs = [ (pkgs.rPackages.buildRPackage { #>     name = \"dplyr\"; #>     src = pkgs.fetchzip { #>       url = \"https://cran.r-project.org/src/contrib/Archive/dplyr/dplyr_0.8.0.tar.gz\"; #>       sha256 = \"sha256-f30raalLd9KoZKZSxeTN71PG6BczXRIiP6g7EZeH09U=\"; #>     }; #>     propagatedBuildInputs = builtins.attrValues { #>       inherit (pkgs.rPackages) assertthat glue magrittr pkgconfig R6 Rcpp rlang tibble tidyselect BH plogr; #>     }; #>   }) #> (pkgs.rPackages.buildRPackage { #>     name = \"janitor\"; #>     src = pkgs.fetchzip { #>       url = \"https://cran.r-project.org/src/contrib/Archive/janitor/janitor_1.0.0.tar.gz\"; #>       sha256 = \"sha256-3NJomE/CNbOZ+ohuVZJWe2n1RVGUm8x8a0A0qzLmdN4=\"; #>     }; #>     propagatedBuildInputs = builtins.attrValues { #>       inherit (pkgs.rPackages) dplyr tidyr snakecase magrittr purrr rlang; #>     }; #>   })]; #>   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   system_packages  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/d1-installing-r-packages-in-a-nix-environment.html","id":"installing-packages-from-github","dir":"Articles","previous_headings":"","what":"Installing packages from Github","title":"d1 - Installing R packages in a Nix environment","text":"also possible install packages Github: install two packages Github: {housing} package specifically code fusen branch. commit also provided, pin exact version package needed. fusen package also installed, main branch commit d617172447d.","code":"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/\",                    branch_name = \"fusen\",                    commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"),                  list(package_name = \"fusen\",                    repo_url = \"https://github.com/ThinkR-open/fusen\",                    branch_name = \"main\",                    commit = \"d617172447d2947efb20ad6a4463742b8a5d79dc\")     ),     ide = \"other\",     project_path = path_default_nix,     overwrite = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # 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/\", #> #  > branch_name = \"fusen\", #> #  > commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"), #> #  > list(package_name = \"fusen\", #> #  > repo_url = \"https://github.com/ThinkR-open/fusen\", #> #  > branch_name = \"main\", #> #  > commit = \"d617172447d2947efb20ad6a4463742b8a5d79dc\")), #> #  > ide = \"other\", #> #  > 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/b-rodrigues/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/\"; #>       branchName = \"fusen\"; #>       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\"; #>       branchName = \"main\"; #>       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  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/d1-installing-r-packages-in-a-nix-environment.html","id":"a-complete-example","dir":"Articles","previous_headings":"","what":"A complete example","title":"d1 - Installing R packages in a Nix environment","text":"example shows install packages CRAN, CRAN archives GitHub: next vignette, vignette(\"d2-installing-system-tools--texlive-packages---nix-environment\"), explains can install tools text editors, git, Quarto, TexLive packages, tool available nixpkgs development environments.","code":"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/\",                    branch_name = \"fusen\",                    commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"),                  list(package_name = \"fusen\",                    repo_url = \"https://github.com/ThinkR-open/fusen\",                    branch_name = \"main\",                    commit = \"d617172447d2947efb20ad6a4463742b8a5d79dc\")     ),     ide = \"other\",     project_path = path_default_nix,     overwrite = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = \"79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a\", #> #  > r_pkgs = c(\"dplyr\", #> #  > \"janitor\", #> #  > \"AER@1.2-8\"), #> #  > git_pkgs = list(list(package_name = \"housing\", #> #  > repo_url = \"https://github.com/rap4all/housing/\", #> #  > branch_name = \"fusen\", #> #  > commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"), #> #  > list(package_name = \"fusen\", #> #  > repo_url = \"https://github.com/ThinkR-open/fusen\", #> #  > branch_name = \"main\", #> #  > commit = \"d617172447d2947efb20ad6a4463742b8a5d79dc\")), #> #  > ide = \"other\", #> #  > 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/b-rodrigues/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/\"; #>       branchName = \"fusen\"; #>       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\"; #>       branchName = \"main\"; #>       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; #>     }; #>   }) (pkgs.rPackages.buildRPackage { #>     name = \"AER\"; #>     src = pkgs.fetchzip { #>       url = \"https://cran.r-project.org/src/contrib/Archive/AER/AER_1.2-8.tar.gz\"; #>       sha256 = \"sha256-OqxXcnUX/2C6wfD5fuNayc8OU+mstI3tt4eBVGQZ2S0=\"; #>     }; #>     propagatedBuildInputs = builtins.attrValues { #>       inherit (pkgs.rPackages) car lmtest sandwich survival zoo Formula; #>     }; #>   })]; #>   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  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/d2-installing-system-tools-and-texlive-packages-in-a-nix-environment.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"d2 - Installing system tools and TexLive packages in a Nix environment","text":"80’000 pieces software available Nix package manager. Nix’s repository packages called nixpkgs includes entirety CRAN Bioconductor. nixpkgs actually “just” Github repository containing thousands upon thousands Nix expressions. installing package, expressions get evaluated, package question gets installed. “installed” means can vary: sometimes package gets built source, sometimes pre-compiled binary package operating system gets downloaded made available. example, Nix expression downloads installs Quarto. example expression downloads pre-compiled binary Quarto’s Github repository, installs . installation process case essentially making sure Quarto able find dependencies, also get installed Nix, R Python packages make Quarto work well languages also get installed. possible use rix() add tools environment vignette explains .","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/d2-installing-system-tools-and-texlive-packages-in-a-nix-environment.html","id":"adding-tools-to-an-environment","dir":"Articles","previous_headings":"","what":"Adding tools to an environment","title":"d2 - Installing system tools and TexLive packages in a Nix environment","text":"call generates default.nix defines environment latest version R. R quarto package also installed, well quarto command line tool (required edit Quarto documents R using quarto package) git: can look available software . Simply look right package name, add system_pkgs argument rix(). trouble finding something, don’t hesitate open issue ask support!","code":"path_default_nix <- tempdir()  rix(r_ver = \"latest\",     r_pkgs = c(\"quarto\"),     system_pkgs = c(\"quarto\", \"git\"),     git_pkgs = NULL,     ide = \"other\",     project_path = path_default_nix,     overwrite = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = \"4008381882569ab4773f2ba0d7b7bbde8f665672\", #> #  > r_pkgs = c(\"quarto\"), #> #  > system_pkgs = c(\"quarto\", #> #  > \"git\"), #> #  > git_pkgs = NULL, #> #  > ide = \"other\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE) #> # It uses nixpkgs' revision 4008381882569ab4773f2ba0d7b7bbde8f665672 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/4008381882569ab4773f2ba0d7b7bbde8f665672.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) quarto; #> }; #>    system_packages = builtins.attrValues { #>   inherit (pkgs) R glibcLocales nix quarto git; #> }; #>   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 = [  rpkgs  system_packages  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/d2-installing-system-tools-and-texlive-packages-in-a-nix-environment.html","id":"installing-texlive-packages","dir":"Articles","previous_headings":"","what":"Installing TexLive packages","title":"d2 - Installing system tools and TexLive packages in a Nix environment","text":"Whether use Quarto, Rmarkdown, Sweave, literate programming R requires TexLive distribution installed. can use rix() install minimalist TexLive distribution add packages require go. basic use simply add TexLive package tex_pkgs argument rix() like : automically add small TexLive distribution available nixpkgs amsmath LaTex package. know setting environments literate programming, refer vignette vignette(\"z-advanced-topic-building--environment--literate-programming\").","code":"path_default_nix <- tempdir()  rix(r_ver = \"latest\",     r_pkgs = c(\"quarto\"),     system_pkgs = \"quarto\",     tex_pkgs = c(\"amsmath\"),     ide = \"other\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = \"4008381882569ab4773f2ba0d7b7bbde8f665672\", #> #  > r_pkgs = c(\"quarto\"), #> #  > system_pkgs = \"quarto\", #> #  > tex_pkgs = c(\"amsmath\"), #> #  > ide = \"other\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE, #> #  > print = TRUE) #> # It uses nixpkgs' revision 4008381882569ab4773f2ba0d7b7bbde8f665672 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/4008381882569ab4773f2ba0d7b7bbde8f665672.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) quarto; #> }; #>   tex = (pkgs.texlive.combine { #>   inherit (pkgs.texlive) scheme-small amsmath; #> }); #>  system_packages = builtins.attrValues { #>   inherit (pkgs) R glibcLocales nix quarto; #> }; #>   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 = [  rpkgs tex system_packages  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/d2-installing-system-tools-and-texlive-packages-in-a-nix-environment.html","id":"installing-ides","dir":"Articles","previous_headings":"","what":"Installing IDEs","title":"d2 - Installing system tools and TexLive packages in a Nix environment","text":"Environments built Nix completely cut rest system, , able use usual IDE interact Nix environments. exception RStudio. Everything explained greater detail vignette vignette(\"e-interactive-use\").","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/e-interactive-use.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"e - Interactive use","text":"vignette describes interactive use environments built rix using GUI editor like RStudio. discuss three scenarios: one already R RStudio installed operating system using usual installation method operating system, another used Nix install R RStudio, finally last scenario assumes use another IDE RStudio, example VS Code, Emacs, Vim… also possible evaluate single functions inside dedicated, separate, environment another, main, interactive R session. details regarding , refer vignette vignette(\"z-advanced-topic-running-r--shell-code--nix--r\").","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/e-interactive-use.html","id":"scenario-1-you-installed-r-and-rstudio-using-the-usual-installers","dir":"Articles","previous_headings":"","what":"Scenario 1: you installed R and RStudio using the usual installers","title":"e - Interactive use","text":"Let’s suppose already running R RStudio wish start using rix define reproducible environments new projects starting today. environments get built using Nix package manager include required R packages project also specific version R, required system-level dependency well. used using RStudio, also need install RStudio using Nix project-specific environments. RStudio re-defines many environment variables , version RStudio installed using usual installer operating system able “see” R interpreter installed Nix. stated macOS-specific vignette vignette(\"b2-setting---using-rix--macos\"), RStudio available macOS nixpkgs. following instructions thus applicable Linux Windows. ’re macOS, read macOS-specific vignette ’s done already, come back skip “scenario 3” vignette. run project-specific version RStudio R, first need create default.nix file build environment defined therein using Nix. done, need activate environment running project-specific version RStudio. Suppose example generated default.nix file project called “kmeans”, suppose project following path: ~/Documents/kmeans (Windows something like C:\\Users\\Billy\\Documents\\kmeans). example, use rix generate default.nix environment: Navigate folder using terminal, run nix-shell. dropped Nix shell. can type rstudio run project specific version R RStudio required packages project, case dplyr ggplot2. get error might need run typing rstudio: solve issue. case, thankful opened issue encountered bug fix worked . can work usual. can also define shortcut project take care activating environment launching RStudio. way, don’t need start terminal folder drop Nix environment time want work project. example, define bash alias like : execute RStudio right project simply typing kmeans terminal. ’s also possible create executable script can save PATH: (needed, add export QT_XCB_GL_INTEGRATION=none line rstudio). Name script something like kmeans_project, make executable (using chmod +x kmeans_project), now can run RStudio within environment anywhere.","code":"library(rix)  path_to_project <- ~/Documents/kmeans  rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"rstudio\",     project_path = path_to_project,     overwrite = TRUE,     print = TRUE) qt.glx: qglx_findConfig: Failed to finding...  qt.glx: qglx_findConfig: Failed to finding... Could not initialize GLX Aborted (core dumped) export QT_XCB_GL_INTEGRATION=none alias kmeans='nix-shell ~/Documents/kmeans/default.nix --run rstudio #!/usr/bin/env nix-shell #!nix-shell /home/Billy/Document/kmeans/default.nix -i bash rstudio"},{"path":"https://b-rodrigues.github.io/rix/articles/e-interactive-use.html","id":"scenario-2-you-dont-have-any-regular-r-and-rstudio-installation-yet","dir":"Articles","previous_headings":"","what":"Scenario 2: you don’t have any regular R and RStudio installation yet","title":"e - Interactive use","text":"don’t R installed use rix package generate new expressions. case might consider installing Nix first, run following command inside terminal get dropped temporary Nix shell, can use generate new default.nix files: Running command download R rix start R session inside terminal. can now run something like : generate default.nix, use file generate environment R, Rstudio, dplyr ggplot2. need add packages project, rerun command , add needed packages r_pkgs. need create new environment, rerun command , install rix environment generate new default.nix files.","code":"nix-shell --expr \"$(curl -sl https://raw.githubusercontent.com/b-rodrigues/rix/master/inst/extdata/default.nix)\" rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"rstudio\",     # change to a project's path or leave it if you're in the right folder already     project_path = \".\",      overwrite = TRUE)"},{"path":"https://b-rodrigues.github.io/rix/articles/e-interactive-use.html","id":"scenario-3-you-use-some-ide-other-than-rstudio","dir":"Articles","previous_headings":"","what":"Scenario 3: you use some IDE other than RStudio","title":"e - Interactive use","text":"VS Code Emacs tested unlike RStudio, can use version VS Code Emacs installed usual means system development environments built Nix. ’s nothing stopping installing project-specific version VS Code Emacs well wish. Configuration settings accessible across every version every environment, since globally defined level system. means work project using VS Code, use call rix() like : Notice ide = \"code\" argument. install VS Code Nix, install languageserver package needed using R VS Code. want also install project-specific version VS Code, use system_pkgs = \"vscode\" system_pkgs = \"vscodium\" prefer VS Codium VS Code. editor Emacs Vim, set ide = \"\". Also use ide = \"\" want run scripts non-interactively, example CI/CD service.","code":"rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"code\",     project_path = \".\",      overwrite = TRUE)"},{"path":"https://b-rodrigues.github.io/rix/articles/e-interactive-use.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"e - Interactive use","text":"now know basics Nix rix can start using projects! still vignettes recommend read cover advanced topics.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-building-an-environment-for-literate-programming.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"z - Advanced topic: Building an environment for literate programming","text":"vignette walk setting development environment rix can used compile Quarto documents PDFs. going use Quarto template JSS illustrate process. first section show simple way achieving , also ideal interactive development (writing doc). second section discuss way build document completely reproducible manner ’s done.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-building-an-environment-for-literate-programming.html","id":"starting-with-the-basics-simple-but-not-entirely-reproducible","dir":"Articles","previous_headings":"","what":"Starting with the basics (simple but not entirely reproducible)","title":"z - Advanced topic: Building an environment for literate programming","text":"approach optimal, simplest. start building development environment dependencies, can use compile document interactively. approach quite reproducible requires manual actions. next section show build 100% reproducible document single command. Since need quarto R package well quarto engine, add r_pkgs system_pkgs arguments rix. want compile PDF, also need texlive installed, well LaTeX packages. , use tex_pkgs argument: (Save lines script called build_env.R instance, run script new folder made project.) default, rix install “small” version texlive distribution available Nix. see texlive packages get installed small version, can click . start adding amsmath package build environment using: terminal, nix_build() interactive R session. , drop Nix shell nix-shell, run quarto add quarto-journals/jss. install template linked . , folder contains build_env.R, generated default.nix result download following files : article-visualization.pdf bibliography.bib template.qmd try compile template.qmd running: get following error message: ’s R chunk template.qmd uses MASS package. Change build_env.R generate new default.nix file now add MASS environment built: Trying compile document results now another error message: means LaTeX orcidlink package missing, can solve problem adding \"orcidlink\" list tex_pkgs. Rebuild environment try compile template. Trying yields new error: Just , add tcolorbox package list tex_pkgs. need several times packages. unfortunately easier way list dependencies requirements LaTeX document. final script build environment looks like: template now compile environment. look LaTeX package, can use search engine CTAN. stated beginning section, approach optimal, merits, especially ’re still working document. environment set , can simply work doc compile needed using quarto render. next section, explain build 100% reproducible document.","code":"path_default_nix <- tempdir()  rix(r_ver = \"4.3.1\",     r_pkgs = c(\"quarto\"),     system_pkgs = \"quarto\",     tex_pkgs = c(\"amsmath\"),     ide = \"other\",     shell_hook = \"\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = \"976fa3369d722e76f37c77493d99829540d43845\", #> #  > r_pkgs = c(\"quarto\"), #> #  > system_pkgs = \"quarto\", #> #  > tex_pkgs = c(\"amsmath\"), #> #  > ide = \"other\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE, #> #  > print = TRUE, #> #  > shell_hook = \"\") #> # It uses nixpkgs' revision 976fa3369d722e76f37c77493d99829540d43845 for reproducibility purposes #> # which will install R version 4.3.1 #> # Report any issues to https://github.com/b-rodrigues/rix #> let #>  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/976fa3369d722e76f37c77493d99829540d43845.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) quarto; #> }; #>   tex = (pkgs.texlive.combine { #>   inherit (pkgs.texlive) scheme-small amsmath; #> }); #>  system_packages = builtins.attrValues { #>   inherit (pkgs) R glibcLocales nix quarto; #> }; #>   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 = [  rpkgs tex system_packages  ]; #>        #>   } nix-build quarto render template.qmd --to jss-pdf Quitting from lines 99-101 [unnamed-chunk-1] (template.qmd) Error in `find.package()`: ! there is no package called 'MASS' Backtrace:  1. utils::data(\"quine\", package = \"MASS\")  2. base::find.package(package, lib.loc, verbose = verbose) Execution halted rix(r_ver = \"4.3.1\",     r_pkgs = c(\"quarto\", \"MASS\"),     system_pkgs = \"quarto\",     tex_pkgs = c(\"amsmath\"),     ide = \"other\",     shell_hook = \"\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = \"976fa3369d722e76f37c77493d99829540d43845\", #> #  > r_pkgs = c(\"quarto\", #> #  > \"MASS\"), #> #  > system_pkgs = \"quarto\", #> #  > tex_pkgs = c(\"amsmath\"), #> #  > ide = \"other\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE, #> #  > print = TRUE, #> #  > shell_hook = \"\") #> # It uses nixpkgs' revision 976fa3369d722e76f37c77493d99829540d43845 for reproducibility purposes #> # which will install R version 4.3.1 #> # Report any issues to https://github.com/b-rodrigues/rix #> let #>  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/976fa3369d722e76f37c77493d99829540d43845.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) quarto MASS; #> }; #>   tex = (pkgs.texlive.combine { #>   inherit (pkgs.texlive) scheme-small amsmath; #> }); #>  system_packages = builtins.attrValues { #>   inherit (pkgs) R glibcLocales nix quarto; #> }; #>   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 = [  rpkgs tex system_packages  ]; #>        #>   } compilation failed- no matching packages LaTeX Error: File `orcidlink.sty' not found compilation failed- no matching packages LaTeX Error: File `tcolorbox.sty' not found. rix(r_ver = \"4.3.1\",     r_pkgs = c(\"quarto\", \"MASS\"),     system_pkgs = \"quarto\",     tex_pkgs = c(       \"amsmath\",       \"environ\",       \"fontawesome5\",       \"orcidlink\",       \"pdfcol\",       \"tcolorbox\",       \"tikzfill\"     ),     ide = \"other\",     shell_hook = \"\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = \"976fa3369d722e76f37c77493d99829540d43845\", #> #  > r_pkgs = c(\"quarto\", #> #  > \"MASS\"), #> #  > system_pkgs = \"quarto\", #> #  > tex_pkgs = c(\"amsmath\", #> #  > \"environ\", #> #  > \"fontawesome5\", #> #  > \"orcidlink\", #> #  > \"pdfcol\", #> #  > \"tcolorbox\", #> #  > \"tikzfill\"), #> #  > ide = \"other\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE, #> #  > print = TRUE, #> #  > shell_hook = \"\") #> # It uses nixpkgs' revision 976fa3369d722e76f37c77493d99829540d43845 for reproducibility purposes #> # which will install R version 4.3.1 #> # Report any issues to https://github.com/b-rodrigues/rix #> let #>  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/976fa3369d722e76f37c77493d99829540d43845.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) quarto MASS; #> }; #>   tex = (pkgs.texlive.combine { #>   inherit (pkgs.texlive) scheme-small amsmath environ fontawesome5 orcidlink pdfcol tcolorbox tikzfill; #> }); #>  system_packages = builtins.attrValues { #>   inherit (pkgs) R glibcLocales nix quarto; #> }; #>   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 = [  rpkgs tex system_packages  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-building-an-environment-for-literate-programming.html","id":"reproducible-literate-programming","dir":"Articles","previous_headings":"","what":"100% reproducible literate programming","title":"z - Advanced topic: Building an environment for literate programming","text":"Let’s forget Nix just package manager, also programming language. default.nix files rix generates written language, made entirely purpose building software. developer, may realise process compiling Quarto LaTeX document similar process building piece software. can use Nix compile document completely reproducible environment. First, let’s fork repo contains Quarto template need. fork repo. repo contains template.qmd file can change (fork , practice replace template.qmd , finished, source .qmd file). Now need change default.nix: following: changed second part file, ’re building shell anymore using mkShell, derivation. Derivation Nix jargon package, software. derivation? First, clone repo forked just (forked repository called my_paper): repo contains quarto template, ’re using specific commit, always use exactly release template document. contrast used quarto add quarto-journals/jss install template. interactively makes project reproducible compile Quarto doc today, using template today, compile document 6 months, using template 6 months (say possible install specific releases Quarto templates using following notation: quarto add quarto-journals/jss@v0.9.2 problem can mitigated). next part file contains following lines: buildInputs . ’s new buildPhase. actually part document gets compiled. first step create home directory. Quarto needs save template want use /home/.cache/deno. ’re using quarto interactively, ’s issue, since home directory used. Nix, things different, need create empty directory specify home. two lines : ($PWD —Print Working Directory— shell variable referring current working directory.) Now, need install template cloned Github. can use quarto add just , instead installing directly Github, install repository cloned. also add ---prompt flag template gets installed without asking us confirmation. similar building Docker image, don’t want interactive prompt show , else process get stuck. $src refers path downloaded Github repository. Finally can compile document: compile template.qmd (finished paper). Finally, ’s installPhase: $shell variable defined inside build environment refers path, can use create directory contain output (compiled PDF file). use mkdir -p recursively create directory structure, copy compiled document $/. can now build document running nix_build(). Now, may confused fact won’t see PDF working directory. remember software built Nix always stored Nix store, PDF also store, since built. find , run: show path PDF. use open PDF PDF viewer application (Linux least):","code":"let  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/976fa3369d722e76f37c77493d99829540d43845.tar.gz\") {};  rpkgs = builtins.attrValues {    inherit (pkgs.rPackages) quarto MASS;  };  tex = (pkgs.texlive.combine {    inherit (pkgs.texlive) scheme-small amsmath environ fontawesome5 orcidlink pdfcol tcolorbox tikzfill;  });  system_packages = builtins.attrValues {    inherit (pkgs) R quarto;  };  in  pkgs.mkShell {    buildInputs = [  rpkgs tex system_packages  ];  } let  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/976fa3369d722e76f37c77493d99829540d43845.tar.gz\") {};  rpkgs = builtins.attrValues {   inherit (pkgs.rPackages) quarto MASS;  };  tex = (pkgs.texlive.combine {   inherit (pkgs.texlive) scheme-small amsmath environ fontawesome5 orcidlink pdfcol tcolorbox tikzfill;  });  system_packages = builtins.attrValues {   inherit (pkgs) R quarto;  };  in  pkgs.stdenv.mkDerivation {    name = \"my-paper\";    src = pkgs.fetchgit {        url = \"https://github.com/b-rodrigues/my_paper/\";        branchName = \"main\";        rev = \"715e9f007d104c23763cebaf03782b8e80cb5445\";        sha256 = \"sha256-e8Xg7nJookKoIfiJVTGoJkvCuFNTT83YZ6SK3GT2T8g=\";      };    buildInputs = [  rpkgs tex system_packages  ];    buildPhase =      ''      # Deno needs to add stuff to $HOME/.cache      # so we give it a home to do this      mkdir home      export HOME=$PWD/home      quarto add --no-prompt $src      quarto render $PWD/template.qmd --to jss-pdf      '';    installPhase =      ''      mkdir -p $out      cp template.pdf $out/      '';  } pkgs.stdenv.mkDerivation {   name = \"my-paper\";   src = pkgs.fetchgit {       url = \"https://github.com/b-rodrigues/my_paper/\";       branchName = \"main\";       rev = \"715e9f007d104c23763cebaf03782b8e80cb5445\";       sha256 = \"sha256-e8Xg7nJookKoIfiJVTGoJkvCuFNTT83YZ6SK3GT2T8g=\";     }; buildInputs = [  rpkgs tex system_packages  ]; buildPhase =   ''   # Deno needs to add stuff to $HOME/.cache   # so we give it a home to do this   mkdir home   export HOME=$PWD/home   quarto add --no-prompt $src   quarto render $PWD/template.qmd --to jss-pdf   ''; mkdir home export HOME=$PWD/home quarto render $PWD/template.qmd --to jss-pdf installPhase =   ''   mkdir -p $out   cp template.pdf $out/   ''; readlink result xdg-open $(readlink result)/template.pdf"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-building-an-environment-for-literate-programming.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"z - Advanced topic: Building an environment for literate programming","text":"vignette showed two approaches, merits: first approach interactive useful writing document. get access shell can work document compile quickly. second approach useful document ready want way quickly rebuilding reproducibility purposes.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-handling-packages-with-remote-dependencies.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"z - Advanced topic: Handling packages with remote dependencies","text":"Packages published CRAN must dependencies either CRAN Bioconductor, GitHub. However, many packages available GitHub never get published CRAN, packages may even depend packages also available GitHub. rix makes possible install packages GitHub, case one package’s dependencies also released GitHub, building Nix environment fail. Nix looking packages nixpkgs, packages released CRAN Bioconductor available nixpkgs. vignette explains install packages dependencies available GitHub.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-handling-packages-with-remote-dependencies.html","id":"the-lookup-package","dir":"Articles","previous_headings":"","what":"The {lookup} package","title":"z - Advanced topic: Handling packages with remote dependencies","text":"example going use {lookup} package released GitHub. repository. package comes lookup() function makes possible check source code function loaded package, even source function C Fortran. create reproducible development environment makes {lookup} available , use following rix::rix() call: Trying build environment fail following error message:","code":"path_default_nix <- tempdir()  rix(r_ver = \"latest\",     r_pkgs = NULL,     system_pkgs = NULL,     git_pkgs = list(package_name = \"lookup\",                     repo_url = \"https://github.com/jimhester/lookup/\",                     branch_name = \"master\",                     commit = \"eba63db477dd2f20153b75e2949eb333a36cccfc\"),     ide = \"other\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = \"4008381882569ab4773f2ba0d7b7bbde8f665672\", #> #  > r_pkgs = NULL, #> #  > system_pkgs = NULL, #> #  > git_pkgs = list(package_name = \"lookup\", #> #  > repo_url = \"https://github.com/jimhester/lookup/\", #> #  > branch_name = \"master\", #> #  > commit = \"eba63db477dd2f20153b75e2949eb333a36cccfc\"), #> #  > ide = \"other\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE, #> #  > print = TRUE) #> # It uses nixpkgs' revision 4008381882569ab4773f2ba0d7b7bbde8f665672 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/4008381882569ab4773f2ba0d7b7bbde8f665672.tar.gz\") {}; #>   git_archive_pkgs = [(pkgs.rPackages.buildRPackage { #>     name = \"lookup\"; #>     src = pkgs.fetchgit { #>       url = \"https://github.com/jimhester/lookup/\"; #>       branchName = \"master\"; #>       rev = \"eba63db477dd2f20153b75e2949eb333a36cccfc\"; #>       sha256 = \"sha256-arl7LVxL8xGUW3LhuDCSUjcfswX0rdofL/7v8Klw8FM=\"; #>     }; #>     propagatedBuildInputs = builtins.attrValues { #>       inherit (pkgs.rPackages) gh memoise Rcpp codetools crayon rex highlite jsonlite rstudioapi withr httr; #>     }; #>   }) ]; #>   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   system_packages  ]; #>        #>   } error: attribute 'highlite' missing"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-handling-packages-with-remote-dependencies.html","id":"building-remote-dependencies","dir":"Articles","previous_headings":"","what":"Building remote dependencies","title":"z - Advanced topic: Handling packages with remote dependencies","text":"{highlite} dependency {lookup} available GitHub. can checked looking DESCRIPTION file {lookup}: see actually three packages come GitHub: gh memoise meantime released CRAN, means also available nixpkgs. deal {highlite} however, never got released CRAN. fairly easy: first, create new expression using rix install {highlite}: (don’t need overwrite previous expression, simply printing one screen ). Copy following lines: previous expression (change git_archive_pkgs highlite). file look like now: thing need change line: : Building expression now succeeds. know quite tedious, moment plans make rix handle remote dependencies automatically. mainly three reasons: packages remote dependencies rare, never CRAN Bioconductor; packages may remote dependencies, dependencies may later available CRAN (memoise gh {lookup}); rix decide user commit use remote dependency (whether use released version dependency CRAN). reasons, believe safer users really need use packages manually edit Nix expressions. Don’t hesitate open issue require assistance.","code":"Remotes:     jimhester/highlite,     gaborcsardi/gh,     hadley/memoise rix(r_ver = \"latest\",     r_pkgs = NULL,     system_pkgs = NULL,     git_pkgs = list(package_name = \"highlite\",                     repo_url = \"https://github.com/jimhester/highlite/\",                     branch_name = \"master\",                     commit = \"767b122ef47a60a01e1707e4093cf3635a99c86b\"),     ide = \"other\",     project_path = path_default_nix,     overwrite = FALSE,     print = TRUE) git_archive_pkgs = [(pkgs.rPackages.buildRPackage {   name = \"highlite\";   src = pkgs.fetchgit {     url = \"https://github.com/jimhester/highlite/\";     branchName = \"master\";     rev = \"767b122ef47a60a01e1707e4093cf3635a99c86b\";     sha256 = \"sha256-lkWMlAi75MYxiBUYnLwxLK9ApXkWanA4Mt7g4qtLpxM=\";   };   propagatedBuildInputs = builtins.attrValues {     inherit (pkgs.rPackages) Rcpp BH;   }; }) ]; let  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/b200e0df08f80c32974a6108ce431d8a8a5e6547.tar.gz\") {};    highlite = [(pkgs.rPackages.buildRPackage {     name = \"highlite\";     src = pkgs.fetchgit {       url = \"https://github.com/jimhester/highlite/\";       branchName = \"master\";       rev = \"767b122ef47a60a01e1707e4093cf3635a99c86b\";       sha256 = \"sha256-lkWMlAi75MYxiBUYnLwxLK9ApXkWanA4Mt7g4qtLpxM=\";     };     propagatedBuildInputs = builtins.attrValues {       inherit (pkgs.rPackages) Rcpp BH;     };   }) ];   git_archive_pkgs = [(pkgs.rPackages.buildRPackage {     name = \"lookup\";     src = pkgs.fetchgit {       url = \"https://github.com/jimhester/lookup/\";       branchName = \"master\";       rev = \"eba63db477dd2f20153b75e2949eb333a36cccfc\";       sha256 = \"sha256-arl7LVxL8xGUW3LhuDCSUjcfswX0rdofL/7v8Klw8FM=\";     };     propagatedBuildInputs = builtins.attrValues {       inherit (pkgs.rPackages) gh memoise Rcpp codetools crayon rex highlite jsonlite rstudioapi withr httr;     };   }) ];  system_packages = builtins.attrValues {   inherit (pkgs) R ; };   in   pkgs.mkShell {     buildInputs = [ git_archive_pkgs  system_packages  ];       shellHook = '' R --vanilla '';   } propagatedBuildInputs = builtins.attrValues {       inherit (pkgs.rPackages) gh memoise Rcpp codetools crayon rex highlite jsonlite rstudioapi withr httr;     }; propagatedBuildInputs = builtins.attrValues {       inherit (pkgs.rPackages) gh memoise Rcpp codetools crayon rex jsonlite rstudioapi withr httr;     } ++ [highlite];"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-reproducible-analytical-pipelines-with-nix.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"z - Advanced topic: Reproducible Analytical Pipelines with Nix","text":"Isolated environments great run pipelines safe reproducible manner. vignette details build reproducible analytical pipeline using environment built Nix contains right version R packages.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-reproducible-analytical-pipelines-with-nix.html","id":"an-example-of-a-reproducible-analytical-pipeline-using-nix","dir":"Articles","previous_headings":"","what":"An example of a reproducible analytical pipeline using Nix","title":"z - Advanced topic: Reproducible Analytical Pipelines with Nix","text":"Suppose ’ve used targets build pipeline project using tailor-made Nix environment. call rix() used build environment: call rix() generates following default.nix file: environment gets built default.nix file contains R version 4.2.2, targets tarchetypes packages, well {housing} packages, package hosted GitHub data useful functions project. Github, gets installed using buildRPackage function Nix. can use environment work project, launch targets pipeline. Github repository contains finalized project. local machine, execute pipeline environment running terminal: wish run pipeline whenever drop Nix shell, add Shell-hook generated default.nix file: Now, time drop Nix shell project using nix-shell, pipeline gets automatically executed. rix also features function called tar_nix_ga() adds GitHub Actions workflow file make pipeline run automatically GitHub Actions. GitHub repository linked file, time changes get pushed, pipeline runs Github Actions results automatically pushed branch called targets-runs. See workflow file . feature heavily inspired adapted targets::github_actions() function.","code":"path_default_nix <- tempdir()  rix(r_ver = \"4.2.2\",     r_pkgs = c(\"targets\", \"tarchetypes\", \"rmarkdown\"),     system_pkgs = NULL,     git_pkgs = list(package_name = \"housing\",                     repo_url = \"https://github.com/rap4all/housing/\",                     branch_name = \"fusen\",                     commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"),     ide = \"other\",     project_path = path_default_nix,     overwrite = TRUE) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = \"8ad5e8132c5dcf977e308e7bf5517cc6cc0bf7d8\", #> #  > r_pkgs = c(\"targets\", #> #  > \"tarchetypes\", #> #  > \"rmarkdown\"), #> #  > system_pkgs = NULL, #> #  > git_pkgs = list(package_name = \"housing\", #> #  > repo_url = \"https://github.com/rap4all/housing/\", #> #  > branch_name = \"fusen\", #> #  > commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"), #> #  > ide = \"other\", #> #  > project_path = path_default_nix, #> #  > overwrite = TRUE) #> # It uses nixpkgs' revision 8ad5e8132c5dcf977e308e7bf5517cc6cc0bf7d8 for reproducibility purposes #> # which will install R version 4.2.2 #> # Report any issues to https://github.com/b-rodrigues/rix #> let #>  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/8ad5e8132c5dcf977e308e7bf5517cc6cc0bf7d8.tar.gz\") {}; #>  rpkgs = builtins.attrValues { #>   inherit (pkgs.rPackages) targets tarchetypes rmarkdown; #> }; #>  git_archive_pkgs = [(pkgs.rPackages.buildRPackage { #>     name = \"housing\"; #>     src = pkgs.fetchgit { #>       url = \"https://github.com/rap4all/housing/\"; #>       branchName = \"fusen\"; #>       rev = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"; #>       sha256 = \"sha256-s4KGtfKQ7hL0sfDhGb4BpBpspfefBN6hf+XlslqyEn4=\"; #>     }; #>     propagatedBuildInputs = builtins.attrValues { #>       inherit (pkgs.rPackages) dplyr ggplot2 janitor purrr readxl rlang rvest stringr tidyr; #>     }; #>   }) ]; #>   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  ]; #>        #>   } cd /absolute/path/to/housing/ && nix-shell default.nix --run \"Rscript -e 'targets::tar_make()'\" rix(r_ver = \"4.2.2\",     r_pkgs = c(\"targets\", \"tarchetypes\", \"rmarkdown\"),     system_pkgs = NULL,     git_pkgs = list(package_name = \"housing\",                     repo_url = \"https://github.com/rap4all/housing/\",                     branch_name = \"fusen\",                     commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"),     ide = \"other\",     shell_hook = \"Rscript -e 'targets::tar_make()'\",     project_path = path_default_nix,     overwrite = TRUE)"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"testing-code-in-evolving-software-dependency-environments-with-confidence","dir":"Articles","previous_headings":"","what":"Testing code in evolving software dependency environments with confidence","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"Adhering sound versioning practices crucial ensuring reproducibility software. Despite expertise software engineering, ever-growing complexity continuous development new, potentially disruptive features present significant challenges maintaining code functionality time. pertains backward compatibility also future-proofing. code handles critical production loads relies numerous external software libraries, ’s likely dependencies evolve. Infrastructure--code DevOps principles shine addressing challenges. However, may appear less approachable labor-intensive set average R developer. ready test custom R functions system commands different environment isolated software builds pure build runtime, without leaving R console? Let’s introduce with_nix(). with_nix() evaluate custom R code shell commands command line interfaces provided Nixpkgs Nix environment, thereby bring read-eval-print-loop feeling. can evaluate custom R functions shell commands Nix environments, can also bring results back current R session R objects.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"two-operational-modes-of-computations-in-environments-system-to-nix-and-nix-to-nix","dir":"Articles","previous_headings":"","what":"Two operational modes of computations in environments: ‘System-to-Nix’ and ‘Nix-to-Nix’","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"aim accommodate various use cases, considering gradient declarativity individual sets software environments based personal preferences. two main modes defining comparing code running R system commands (command line interfaces; CLIs) ‘System--Nix’ environments: assume launch R session R version defined host operating system, either terminal integrated development environment like RStudio. need make sure actively control know installed R R packages , versions. may interactively tested custom function pipeline worked current setup. importantly, want check whether get computations running achieve identical results going back Nix revision represent either newer also older versions R package sources. ‘Nix--Nix’ environments: goals testing code 1., want fine-grained control source environment launch with_nix() , . probably way getting passionate Nix user.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"case-study-1-evolution-of-base-r","dir":"Articles","previous_headings":"","what":"Case study 1: Evolution of base R","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"Carefully curated software improves time, R. pick example R changelog, following literal entry R 4.2.0: “.vector() gains data.frame method returns simple named list, also clearing long standing ‘FIXME’ enable .vector(, mode =\"list\"). breaks code relying .vector() return unchanged data frame.” goal illustrate change behavior R versions 4.1.3 R versions 4.2.0 later.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"setting-up-the-r-software-environment-with-nix","dir":"Articles","previous_headings":"Case study 1: Evolution of base R","what":"Setting up the (R) software environment with Nix","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"first create isolated directory prepare Nix environment, write custom .Rprofile file well. default, R derivation Nixpkgs includes user library first position (returned .libPaths()). Startup code written local .Rprofile make sure system’s user library (R_LIBS_USER) excluded library paths load packages . nice install packages Nix-R session environment ad-hoc interactive manner. However, comes cost one needs aware potential run-time pollution packages outside pool paths per package nix store. macOS, experienced high-chance segmentation faults accidentally loading packages linked system libraries system’s user library, give example. rix::rix_init() writes configuration takes care runtime-pure R package libraries declaratively defined Nix builds. Additionally, modifies .libPaths() running R session. generate following .Rprofile file. Next, write default.nix file containing Nix expressions pin R version 4.2.0 Nixpkgs. following expression written default.nix subfolder ./_env_1_R-4-1-3/.","code":"library(\"rix\")  path_env_1 <- file.path(\".\", \"_env_1_R-4-1-3\")  rix_init(   project_path = path_env_1,   rprofile_action = \"overwrite\",   message_type = \"simple\" ) #>  #> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #>  #> ==> Created isolated nix-R project folder: #>  /home/runner/work/rix/rix/vignettes/_env_1_R-4-1-3  #>  #> ==> R session running via host operating system or docker #> * R session not running from RStudio #> ==> Added `.Rprofile` file and code lines for new R sessions launched from: #> /home/runner/work/rix/rix/vignettes/_env_1_R-4-1-3 #>  #> * Added the location of the Nix store to `PATH` environmental variable for new R sessions on host/docker RStudio: #> /nix/var/nix/profiles/default/bin list.files(path = path_env_1, all.files = TRUE) #> [1] \".\"         \"..\"        \".Rprofile\" #> ### File generated by `rix::rix_init()` ### #> # 1. Currently, system RStudio does not inherit environmental variables #> #   defined in `$HOME/.zshrc`, `$HOME/.bashrc` and alike. This is workaround to  #> #   make the path of the nix store and hence basic nix commands available #> #   in an RStudio session #> # 2. For nix-R session, remove `R_LIBS_USER`, system's R user library.`. #> #   This guarantees no user libraries from the system are loaded and only  #> #   R packages in the Nix store are used. This makes Nix-R behave in pure manner #> #   at run-time. #> { #>     is_rstudio <- Sys.getenv(\"RSTUDIO\") == \"1\" #>     is_nixr <- nzchar(Sys.getenv(\"NIX_STORE\")) #>     if (isFALSE(is_nixr) && isTRUE(is_rstudio)) { #>         cat(\"{rix} detected RStudio R session\") #>         old_path <- Sys.getenv(\"PATH\") #>         nix_path <- \"/nix/var/nix/profiles/default/bin\" #>         has_nix_path <- any(grepl(nix_path, old_path)) #>         if (isFALSE(has_nix_path)) { #>             Sys.setenv(PATH = paste(old_path, nix_path, sep = \":\")) #>         } #>         rm(old_path, nix_path) #>     } #>     if (isTRUE(is_nixr)) { #>         current_paths <- .libPaths() #>         userlib_paths <- Sys.getenv(\"R_LIBS_USER\") #>         user_dir <- grep(paste(userlib_paths, collapse = \"|\"), current_paths) #>         new_paths <- current_paths[-user_dir] #>         .libPaths(new_paths) #>         rm(current_paths, userlib_paths, user_dir, new_paths) #>     } #>     rm(is_rstudio, is_nixr) #> } rix(   r_ver = \"4.1.3\",   overwrite = TRUE,   project_path = path_env_1 ) #> # This file was generated by the {rix} R package v0.6.0 on 2024-03-13 #> # with following call: #> # >rix(r_ver = \"6e3a86f2f73a466656a401302d3ece26fba401d9\", #> #  > project_path = path_env_1, #> #  > overwrite = TRUE) #> # It uses nixpkgs' revision 6e3a86f2f73a466656a401302d3ece26fba401d9 for reproducibility purposes #> # which will install R version 4.1.3 #> # Report any issues to https://github.com/b-rodrigues/rix #> let #>  pkgs = import (fetchTarball \"https://github.com/NixOS/nixpkgs/archive/6e3a86f2f73a466656a401302d3ece26fba401d9.tar.gz\") {}; #>     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 = [    system_packages  ]; #>        #>   }"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"defining-and-interactively-testing-custom-r-code-with-functions","dir":"Articles","previous_headings":"Case study 1: Evolution of base R","what":"Defining and interactively testing custom R code with function(s)","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"know set configuration R 4.1.3 set default.nix file folder ./_env_1_R-4-1-3. Since sure using R version higher 4.2.0 available system, can check .vector.data.frame() S3 method returns list. different R versions 4.1.3 , get identical data frame back.","code":"df <- data.frame(a = 1:3, b = 4:6) as.vector(x = df, mode =\"list\") #> $a #> [1] 1 2 3 #>  #> $b #> [1] 4 5 6"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"run-functioned-up-code-and-investigate-results-produced-in-pure-nix-rsoftware-environments","dir":"Articles","previous_headings":"Case study 1: Evolution of base R","what":"Run functioned up code and investigate results produced in pure Nix Rsoftware environments","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"formally validate ‘System--Nix’ approach object returned .vector.data.frame() R < 4.2.0, define function runs computation . , evaluate test code nix-shell R session. adds build-time run-time purity declarative Nix software configuration made earlier. with_nix() leverages following principles hood: Computing Language: Manipulating language objects using code. Static Code Analysis: Detecting global objects package environments function call stack ‘expr’. involves utilizing essential functionality ‘codetools’ package, recursively iterated. Serialization Dependent R objects: Saving disk deserializing back R session’s RAM via temporary folder. process establishes isolation two distinct computational environments, accommodating ‘System--Nix’ ‘Nix--Nix’ computational modes. Simultaneously, facilitates transfer input arguments, dependencies across call stack, outputs expr Nix-R system’s R sessions. approach guarantees reproducible side effects effectively streams messages errors R session. Thereby, {sys} package facilitates capturing standard outputs errors text output messages. Please aware with_nix() invoke nix-shell, run nix-build case Nix derivation (package) R version 4.1.3 yet Nix store. take bit time get cache. use exec_mode == \"non-blocking\" argument with_nix(), see current R console specific Nix paths downloaded copied Nix store automatically.","code":"df_as_vector <- function(x) {   out <- as.vector(x = x, mode = \"list\")   return(out) } (out_system_1 <- df_as_vector(x = df)) #> $a #> [1] 1 2 3 #>  #> $b #> [1] 4 5 6 # now run it in `nix-shell`; `with_nix()` takes care # of exporting global objects of `df_as_vector` recursively out_nix_1 <- with_nix(   expr = function() df_as_vector(x = df), # wrap to avoid evaluation   program = \"R\",    exec_mode = \"non-blocking\", # run as background process   project_path = path_env_1,    message_type = \"simple\" # you can do `\"verbose\"`, too )  # compare results of custom codebase with indentical  # inputs and different software environments identical(out_system_1, out_nix_1)  # should return `FALSE` if your system's R versions in # current interactive R session is R >= 4.2.0"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"syntax-option-for-specifying-function-in-expr-argument-of-with_nix","dir":"Articles","previous_headings":"Case study 1: Evolution of base R","what":"Syntax option for specifying function in expr argument of with_nix()","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"previous code snippet wrapped top-level expr function function() function(){}. alternative, can also provide default arguments assigning function used expr input like : , just supply name function evaluate default arguments. yields results.","code":"df_as_vector <- function(x = df) {   out <- as.vector(x = x, mode = \"list\")   return(out) } out_nix_1_b <- with_nix(   expr = df_as_vector, # provide name of function   program = \"R\",    exec_mode = \"non-blocking\", # run as background process   project_path = path_env_1,    message_type = \"simple\" # you can do `\"verbose\"`, too ) Reduce(f = identical, list(out_nix_1, out_nix_1_b))"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"comparing-as-vector-data-frame-for-both-r-versions-4-1-3-and-4-2-0-from-nixpkgs","dir":"Articles","previous_headings":"Case study 1: Evolution of base R","what":"Comparing as.vector.data.frame() for both R versions 4.1.3 and 4.2.0 from Nixpkgs","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"follows example Nix--Nix solution, two subshells track evolution base R specific case. can verify breaking changes case study 1 declarative manner use R 4.1.3 R 4.2.0 Nixpkgs. Since already defined R 4.1.3 env_1_R-4-1-3 subshell, can use source environment with_nix() launched . Accordingly, define R 4.2.0 environment env_1_2_R-4-2-0using Nix via rix::rix(). latter environment target environment df_as_vector() evaluated . Now, initiate new R session development environment using nix-shell. Open new terminal current working directory R session. provided expression default.nix. defines R 4.1.3 “subfolder per subshell” approach. nix-shell use expression default.nix prefer .nix files, except put shell.nix file folder, takes precedence. time downloading caches builds, enter R console session R 4.1.3. need type R first, set R shell hook via rix::rix(). Next, define target function test R 4.2.0, . can now formally compare outputs computation code R 4.1.3 vs. R 4.2.0 environments controlled Nix.","code":"library(\"rix\") path_env_1_2 <- file.path(\".\", \"_env_1_2_R-4-2-0\")  rix_init(   project_path = path_env_1_2,   rprofile_action = \"overwrite\",   message_type = \"simple\" ) #>  #> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #>  #> ==> Created isolated nix-R project folder: #>  /home/runner/work/rix/rix/vignettes/_env_1_2_R-4-2-0  #>  #> ==> R session running via host operating system or docker #> * R session not running from RStudio #> ==> Added `.Rprofile` file and code lines for new R sessions launched from: #> /home/runner/work/rix/rix/vignettes/_env_1_2_R-4-2-0 #>  #> * Added the location of the Nix store to `PATH` environmental variable for new R sessions on host/docker RStudio: #> /nix/var/nix/profiles/default/bin  rix(   r_ver = \"4.2.0\",   overwrite = TRUE,   project_path = path_env_1_2,   shell_hook = \"R\" )  list.files(path_env_1_2) #> [1] \"default.nix\" nix-shell --pure ./_env_1_R-4-1-3 # current Nix-R session with R 4.1.3 df_as_vector <- function(x) {   out <- as.vector(x = x, mode = \"list\")   return(out) } (out_nix_1 <- df_as_vector(x = df)) out_nix_1_2 <- with_nix(   expr = function() df_as_vector(x = df),   program = \"R\",   exec_mode = \"non-blocking\", # run as background process   project_path = path_env_1_2,    message_type = \"simple\" # you can do `\"verbose\"`, too ) identical(out_nix_1, out_nix_1_2) # yields FALSE"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"case-study-2-breaking-changes-in-stringr-1-5-0","dir":"Articles","previous_headings":"","what":"Case study 2: Breaking changes in {stringr} 1.5.0","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"add one layer reproducibility R ecosystem. User libraries CRAN GitHub, one thing makes R shine huge collection software packages available community. change introduce {stringr} 1.5.0; earlier versions, line code: return character \"\". However, behaviour unexpected: really return error. addressed versions 1.5.0: Since code returns error, wrap inside tryCatch() return NULL instead error (wouldn’t , vignette compile!). Let’s build subshell latest version R, older version stringr: call generates default.nix file subshell old version stringr: can now run code subshell last lines printed screen: see result evaluating code subshell, also access : out_nix_stringr holds result. can now compare two: result code running main session latest version stringr result code running subshell old version stringr: expected, result FALSE.","code":"stringr::str_subset(c(\"\", \"a\"), \"\") out_system_stringr <- tryCatch(   expr = {stringr::str_subset(c(\"\", \"a\"), \"\")},   error = function(e)NULL) library(\"rix\")  path_env_stringr <- file.path(\".\", \"_env_stringr_1.4.1\")  rix_init(   project_path = path_env_stringr,   rprofile_action = \"overwrite\",   message_type = \"simple\" ) #>  #> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #>  #> ==> Created isolated nix-R project folder: #>  /home/runner/work/rix/rix/vignettes/_env_stringr_1.4.1  #>  #> ==> R session running via host operating system or docker #> * R session not running from RStudio #> ==> Added `.Rprofile` file and code lines for new R sessions launched from: #> /home/runner/work/rix/rix/vignettes/_env_stringr_1.4.1 #>  #> * Added the location of the Nix store to `PATH` environmental variable for new R sessions on host/docker RStudio: #> /nix/var/nix/profiles/default/bin  list.files(path = path_env_stringr, all.files = TRUE) #> [1] \".\"         \"..\"        \".Rprofile\" rix(   r_ver = \"latest\",   r_pkgs = \"stringr@1.4.1\",   overwrite = TRUE,   project_path = path_env_stringr ) out_nix_stringr <- with_nix(   expr = function() stringr::str_subset(c(\"\", \"a\"), \"\"),   program = \"R\",   exec_mode = \"non-blocking\",   project_path = path_env_stringr,   message_type = \"simple\" ) ==> `expr` succeeded!  ### Finished code evaluation in `nix-shell` ###  * Evaluating `expr` in `nix-shell` returns: [1] \"a\" identical(out_system_stringr, out_nix_stringr)"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-running-r-or-shell-code-in-nix-from-r.html","id":"case-study-3-using-a-subshell-to-get-hard-to-install-dependencies","dir":"Articles","previous_headings":"","what":"Case study 3: Using a subshell to get hard to install dependencies","title":"z - Advanced topic: Running R or Shell Code in Nix from R","text":"Nix subshells quite useful cases need use package might difficult install, arrow, packages must compiled. Depending operating system need compile arrow source, can frustrating experience, especially need load data bring manageable size (using select() filter() instance). use cases illustrates achieve . Let’s start building subshell based distinct revision nixpkgs, know arrow compiles linux macOS (darwin). specific revision R contains arrow 13. Let’s now suppose already script code load transform data using arrow. may look something like : run code subshell, recommend wrapping inside function: can run subshell: run function subshell, output saved out_nix_arrow variable, manipulation main shell/session.","code":"library(\"rix\")  path_env_arrow <- file.path(\"env_arrow\")  rix_init(   project_path = path_env_arrow,   rprofile_action = \"overwrite\",   message_type = \"simple\" )  rix(   r_ver = \"af63e7a15daf283b4ce634006b3767f9c0eb0c58\",   r_pkgs = c(\"dplyr\", \"arrow\"),   overwrite = TRUE,   project_path = path_env_arrow ) library(arrow) library(dplyr)  arrow_cars <- arrow_table(cars)  arrow_cars %>%   filter(speed > 10) %>%   as.data.frame() arrow_script <- function() {   library(arrow)   library(dplyr)    arrow_cars <- arrow_table(cars)    arrow_cars %>%     filter(speed > 10) %>%     as.data.frame() } out_nix_arrow <- with_nix(   expr = function() arrow_script(),   program = \"R\",   exec_mode = \"non-blocking\",   project_path = path_env_arrow,   message_type = \"simple\" )"},{"path":"https://b-rodrigues.github.io/rix/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Bruno Rodrigues. Author, maintainer. Philipp Baumann. Author.","code":""},{"path":"https://b-rodrigues.github.io/rix/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Rodrigues B, Baumann P (2024). rix: Rix: Reproducible Environments Nix. R package version 0.6.0, https://b-rodrigues.github.io/rix/.","code":"@Manual{,   title = {rix: Rix: Reproducible Environments with Nix},   author = {Bruno Rodrigues and Philipp Baumann},   year = {2024},   note = {R package version 0.6.0},   url = {https://b-rodrigues.github.io/rix/}, }"},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"introduction","dir":"","previous_headings":"","what":"Introduction","title":"Rix: Reproducible Environments with Nix","text":"rix R package leverages Nix, powerful package manager focusing reproducible builds. Nix, possible create project-specific environments contain project-specific version R R packages (well tools languages, needed). can use rix Nix replace renv Docker one single tool. Nix incredibly useful piece software ensuring reproducibility projects, research otherwise. example, allows run web applications like Shiny apps plumber APIs controlled environment. Nix fairly high entry cost though. Nix complex piece software comes programming language, also called Nix. purpose solve complex problem: defining instructions build software packages manage configurations declarative way. makes sure software gets installed fully reproducible manner, operating system hardware. rix provides functions help write deploy Nix expressions (written Nix language). expressions inputs Nix package manager, build sets software packages provide reproducible development environment. environments can used interactive data analysis, reproduced running pipelines CI/CD systems. Nixpkgs collection, currently 80.000 pieces software available Nix package manager. {rix}, can define build isolated R environments Nix package manager ease. Like , environments contain R required packages need project. can also add software tool available. Nix R ecosystem currently includes entirety CRAN Bioconductor packages. Like programming language software, also possible install older releases R packages, install packages GitHub defined states. Nix package manager extremely powerful. handle dependencies package extremely well deterministic manner, also possible reproduce environments containing old releases software. thus possible build environments containing R version 4.0.0 (example) run old project originally developed version R. stated , Nix, essentially possible replace {renv} Docker combined. need tools languages like Python Julia, can also done easily. Nix available Linux, macOS Windows (via WSL2) rix comes following features: install version R R packages specific projects; several versions R R packages installed time system; define complete development environments code use anywhere; run single R functions (objects call stack) different environment (potentially different R version R packages) interactive R session, get back output function using with_nix(); rix require Nix installed system generate expressions. means can generate expressions system easily install software, use expressions cloud CI/CD environment build project . R installed, can start straight away R session first installing rix: generates file called default.nix path path_default_nix correct expression build environment. build environment, Nix package manager must installed.","code":"install.packages(\"rix\", repos = c(\"https://b-rodrigues.r-universe.dev\",   \"https://cloud.r-project.org\"))  library(\"rix\") path_default_nix <- \".\"  rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"code\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE)"},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"quick-start-for-returning-users","dir":"","previous_headings":"","what":"Quick start for returning users","title":"Rix: Reproducible Environments with Nix","text":"familiar Nix rix skip next section. already familiar Nix R, simply want get started quickly possible, can start installing Nix using installer Determinate Systems company provides services tools built Nix: can check everything works well trying build Nix expression ships rix. Nix expressions typically saved files name default.nix shell.nix. expression installs latest version R rix separate, reproducible environment: everything worked well, see file called result next default.nix. can now enter newly built development environment opening terminal folder typing nix-shell. immediately dropped interactive R session. don’t R installed, Nix package manager installed, can run temporary R session R using command (build environment one ):","code":"curl --proto '=https' --tlsv1.2 -sSf \\     -L https://install.determinate.systems/nix | \\      sh -s -- install file.copy(   # default.nix is the file containing the Nix expression   from = system.file(\"extdata\", \"default.nix\", package = \"rix\"),   to = \".\", overwrite = TRUE )  # nix_build() is a wrapper around the command line tool `nix-build` nix_build(project_path = \".\") nix-shell --expr \"$(curl -sl https://raw.githubusercontent.com/b-rodrigues/rix/master/inst/extdata/default.nix)\""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"getting-started-for-new-users","dir":"","previous_headings":"","what":"Getting started for new users","title":"Rix: Reproducible Environments with Nix","text":"get started rix Nix, read following vignette vignette(\"-getting-started\") (online documentation). vignettes numbered get learn use rix Nix smoothly. ’s lot info, take time reading vignettes. Don’t hesitate open issue something clear.","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"docker","dir":"","previous_headings":"Getting started for new users","what":"Docker","title":"Rix: Reproducible Environments with Nix","text":"can also try Nix inside Docker. , can start image NixOS Docker image. NixOS full GNU/Linux distribution uses Nix system package manager.","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"contributing","dir":"","previous_headings":"","what":"Contributing","title":"Rix: Reproducible Environments with Nix","text":"package developed using fusen package. want contribute, please edit .Rmd files found dev/ folder. , inflate package using fusen::inflate_all(). errors found (warning notes OK), commit open PR. learn use fusen (don’t worry, ’s super easy), refer vignette. development workflow, use semantic versioning via {fledge}.","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"thanks","dir":"","previous_headings":"","what":"Thanks","title":"Rix: Reproducible Environments with Nix","text":"Thanks Nix community making Nix possible, thanks community R users Nix work packaging R CRAN/Bioconductor packages Nix (particular Justin Bedő, Rémi Nicole, nviets, Chris Hammill, László Kupcsik, Simon Lackerbauer, MrTarantoga every person Matrix Nixpkgs R channel).","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"recommended-reading","dir":"","previous_headings":"","what":"Recommended reading","title":"Rix: Reproducible Environments with Nix","text":"NixOS’s website Nixpkgs’s GitHub repository Nix R series Bruno’s blog. , case like video tutorials, watch one Reproducible R development environments Nix nix.dev tutorials INRIA’s Nix tutorial Nix pills Nix Data Science NixOS explained: NixOS entire Linux distribution uses Nix package manager. Blog post: Nix R devtools Blog post: Statistical Rethinking Nix Blog post: Searching installing old versions Nix packages","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/available_r.html","id":null,"dir":"Reference","previous_headings":"","what":"List available R versions from Nixpkgs — available_r","title":"List available R versions from Nixpkgs — available_r","text":"List available R versions Nixpkgs","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/available_r.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List available R versions from Nixpkgs — available_r","text":"","code":"available_r()"},{"path":"https://b-rodrigues.github.io/rix/reference/available_r.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List available R versions from Nixpkgs — available_r","text":"character vector containing available R versions.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/available_r.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List available R versions from Nixpkgs — available_r","text":"","code":"available_r() #>  [1] \"latest\" \"3.0.2\"  \"3.0.3\"  \"3.1.0\"  \"3.1.2\"  \"3.1.3\"  \"3.2.0\"  \"3.2.1\"  #>  [9] \"3.2.2\"  \"3.2.3\"  \"3.2.4\"  \"3.3.3\"  \"3.4.0\"  \"3.4.1\"  \"3.4.2\"  \"3.4.3\"  #> [17] \"3.4.4\"  \"3.5.0\"  \"3.5.1\"  \"3.5.2\"  \"3.5.3\"  \"3.6.0\"  \"3.6.1\"  \"3.6.2\"  #> [25] \"3.6.3\"  \"4.0.0\"  \"4.0.2\"  \"4.0.3\"  \"4.0.4\"  \"4.1.1\"  \"4.1.2\"  \"4.1.3\"  #> [33] \"4.2.0\"  \"4.2.1\"  \"4.2.2\"  \"4.2.3\"  \"4.3.1\""},{"path":"https://b-rodrigues.github.io/rix/reference/nix_build.html","id":null,"dir":"Reference","previous_headings":"","what":"Invoke shell command nix-build from an R session — nix_build","title":"Invoke shell command nix-build from an R session — nix_build","text":"Invoke shell command nix-build R session","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/nix_build.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Invoke shell command nix-build from an R session — nix_build","text":"","code":"nix_build(project_path = \".\", exec_mode = c(\"blocking\", \"non-blocking\"))"},{"path":"https://b-rodrigues.github.io/rix/reference/nix_build.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Invoke shell command nix-build from an R session — nix_build","text":"project_path Path folder default.nix file resides. default \".\", working directory current R session. exec_mode Either \"blocking\" (default) \"non-blocking. either block R session nix-build shell command executed, run nix-build background (\"non-blocking\").","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/nix_build.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Invoke shell command nix-build from an R session — nix_build","text":"integer process ID (PID) nix-build shell command launched, nix_build() call assigned R object. Otherwise, returned invisibly.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/nix_build.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Invoke shell command nix-build from an R session — nix_build","text":"nix-build command line interface arguments. probably support R wrapper, currently support following nix-build flags: --max-jobs: Maximum number build jobs done parallel Nix. According official docs Nix, defaults 1, one core. option can useful shared memory multiprocessing systems high /O latency. set --max-jobs used, can declare options(rix.nix_build_max_jobs = ). call nix_build() flag propagated call nix-build.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/nix_build.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Invoke shell command nix-build from an R session — nix_build","text":"","code":"if (FALSE) {   nix_build() }"},{"path":"https://b-rodrigues.github.io/rix/reference/r_nix_revs.html","id":null,"dir":"Reference","previous_headings":"","what":"r_nix_revs — r_nix_revs","title":"r_nix_revs — r_nix_revs","text":"Nix revisions old R releases","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/r_nix_revs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"r_nix_revs — r_nix_revs","text":"","code":"r_nix_revs"},{"path":"https://b-rodrigues.github.io/rix/reference/r_nix_revs.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"r_nix_revs — r_nix_revs","text":"data frame 34 rows 3 variables: version R version revision Nix revision containing version R date Date revision available","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/r_nix_revs.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"r_nix_revs — r_nix_revs","text":"Nix Package Version, Marcelo Lazaroni","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":null,"dir":"Reference","previous_headings":"","what":"rix Generates a Nix expression that builds a reproducible development environment — rix","title":"rix Generates a Nix expression that builds a reproducible development environment — rix","text":"rix Generates Nix expression builds reproducible development environment","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"rix Generates a Nix expression that builds a reproducible development environment — rix","text":"","code":"rix(   r_ver = \"latest\",   r_pkgs = NULL,   system_pkgs = NULL,   git_pkgs = NULL,   tex_pkgs = NULL,   ide = \"other\",   project_path = \".\",   overwrite = FALSE,   print = FALSE,   shell_hook = NULL )"},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"rix Generates a Nix expression that builds a reproducible development environment — rix","text":"r_ver Character, defaults \"latest\". required R version, example \"4.0.0\". can check R versions available using available_r. reproducibility purposes, can also provide nixpkgs revision directly. r_pkgs Vector characters. List required R packages analysis . system_pkgs Vector characters. List software wish install R packages command line applications example. can look available software NixOS website https://search.nixos.org/packages?channel=unstable&=0&size=50&sort=relevance&type=packages&query= git_pkgs List. list packages install Git. See details information. tex_pkgs Vector characters. set tex packages install. Use need compile .tex documents, build PDF documents using Quarto. know package add, start adding \"amsmath\". See Vignette \"Authoring LaTeX documents\" details. ide Character, defaults \"\". wish use RStudio work interactively use \"rstudio\" \"code\" Visual Studio Code. editors, use \"\". tested RStudio, VS Code Emacs. editors work, please open issue. project_path Character, defaults current working directory. write default.nix, example \"/home/path//project\". file thus written file \"/home/path//project/default.nix\". overwrite Logical, defaults FALSE. TRUE, overwrite default.nix file specified path. print Logical, defaults FALSE. TRUE, print default.nix console. shell_hook Character length 1, defaults NULL. Commands added shellHook variable executed Nix shell starts. default, using nix-shell default.nix (path shell.nix) start specific program, possibly flags (separated space), /shell actions. can example use shell_hook = R, want directly enter declared Nix R session.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"rix Generates a Nix expression that builds a reproducible development environment — rix","text":"Nothing, function side-effect writing file called \"default.nix\" working directory. file contains expression build reproducible environment using Nix package manager.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"rix Generates a Nix expression that builds a reproducible development environment — rix","text":"function write default.nix chosen path. Using Nix package manager, possible build reproducible development environment using nix-build command path. environment contain chosen version R packages, interfere installed version (via Nix ) machine. Every dependency, including R package dependencies also system dependencies like compilers get installed well environment. use RStudio interactive work, set rstudio parameter TRUE. use another IDE (example Emacs Visual Studio Code), need add default.nix file, can simply use version installed computer. built environment using nix-build, can drop interactive session using nix-shell. See \"Building reproducible development environments rix\" vignette detailled instructions. Packages install Github must provided list 4 elements: \"package_name\", \"repo_url\", \"branch_name\" \"commit\". argument can also list lists 4 elements. also possible install old versions packages specifying version. example, install latest version {AER} old version {ggplot2}, write: r_pkgs = c(\"AER\", \"ggplot2@2.2.1\"). Note however result dependency hell, older version package might need older versions dependencies, packages might need recent versions dependencies. instead want use environment looked time {ggplot2}'s version 2.2.1 release, use Nix revision closest date, setting r_ver = \"3.1.0\", version R current time. ensures Nix builds completely coherent environment. default, nix shell configured \"en_US.UTF-8\" relevant locale variables (LANG, LC_ALL, LC_TIME, LC_MONETARY, LC_PAPER, LC_MEASUREMENT). done ensure locale reproducibility default Nix environments created rix(). good reasons stick default, can set preferred locale variables via options(rix.nix_locale_variables = list(LANG = \"de_CH.UTF-8\", <...>) aforementioned locale variable names.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"rix Generates a Nix expression that builds a reproducible development environment — rix","text":"","code":"if (FALSE) { # Build an environment with the latest version of R # and the dplyr and ggplot2 packages rix(r_ver = \"latest\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     ide = \"code\",     project_path = path_default_nix,     overwrite = TRUE,     print = TRUE,     shell_hook = NULL) }"},{"path":"https://b-rodrigues.github.io/rix/reference/rix_init.html","id":null,"dir":"Reference","previous_headings":"","what":"Initiate and maintain an isolated, project-specific, and runtime-pure R\nsetup via Nix. — rix_init","title":"Initiate and maintain an isolated, project-specific, and runtime-pure R\nsetup via Nix. — rix_init","text":"Creates isolated project folder Nix-R configuration. rix::rix_init() also adds, appends, updates without backup custom .Rprofile file code initializes startup R environment without system's user libraries within Nix software environment. Instead, restricts search paths load R packages exclusively Nix store. Additionally, makes Nix utilities like nix-shell available run system commands system's RStudio R session, Linux macOS.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix_init.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initiate and maintain an isolated, project-specific, and runtime-pure R\nsetup via Nix. — rix_init","text":"","code":"rix_init(   project_path = \".\",   rprofile_action = c(\"create_missing\", \"create_backup\", \"overwrite\", \"append\"),   message_type = c(\"simple\", \"verbose\") )"},{"path":"https://b-rodrigues.github.io/rix/reference/rix_init.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initiate and maintain an isolated, project-specific, and runtime-pure R\nsetup via Nix. — rix_init","text":"project_path Character folder path isolated nix-R project. Defaults \".\", current working directory path. folder exist yet, created. rprofile_action Character. Action take .Rprofile file destined project_path folder. Possible values include \"create_missing\", writes .Rprofile yet exist (otherwise nothing); \"create_backup\", copies existing .Rprofile new backup file, generating names POSIXct-derived strings include time zone information. new .Rprofile file written default code rix::rix_init(); \"overwrite\" overwrites .Rprofile file exist; \"append\" appends existing file code tailored isolated Nix-R project setup. message_type Character. Message type, defaults \"simple\", gives minimal sufficient feedback. values currently \"verbose\", provides detailed diagnostics.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix_init.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Initiate and maintain an isolated, project-specific, and runtime-pure R\nsetup via Nix. — rix_init","text":"Nothing, function side-effect writing file called \".Rprofile\" specified path.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix_init.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Initiate and maintain an isolated, project-specific, and runtime-pure R\nsetup via Nix. — rix_init","text":"Enhancement computational reproducibility Nix-R environments: primary goal rix::rix_init() enhance computational reproducibility Nix-R environments runtime. Notably, restart required environmental variables set current session, addition writing .Rprofile file. particularly useful make with_nix() evaluate custom R functions \"Nix--Nix\" \"System--Nix\" R setups. introduces two side-effects take effect current later R session setup: Adjusting R_LIBS_USER path: default, first path R_LIBS_USER points user library outside Nix store (see also base::.libPaths()). creates friction potential impurity R packages system's R user library loaded. feature can useful interactively testing R package Nix environment adding .nix configuration, can undesired effects managed carefully. major drawback R packages R_LIBS_USER location need cleaned avoid loading packages outside Nix configuration. Issues, especially macOS, may arise due segmentation faults incompatible linked system libraries. problems can also occur one (reverse) dependencies R package loaded  along process. Make Nix commands available running system commands RStudio: host RStudio session launched via Nix (nix-shell), environmental variables ~/.zshrc ~/.bashrc may inherited. Consequently, Nix command line interfaces like nix-shell might found. .Rprofile code written rix::rix_init() ensures Nix command line programs accessible adding path \"bin\" directory default Nix profile, \"/nix/var/nix/profiles/default/bin\", PATH variable RStudio R session. side effects particularly recommended working flexible R environments, especially users want maintain system's native R setup utilize Nix expressions reproducible development environments. init configuration considered pivotal enhance adoption Nix R community, particularly RStudio Nixpkgs packaged macOS. recommend calling rix::rix_init() prior comparing R code ran two software environments rix::with_nix().","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/reference/rix_init.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Initiate and maintain an isolated, project-specific, and runtime-pure R\nsetup via Nix. — rix_init","text":"","code":"if (FALSE) { # create an isolated, runtime-pure R setup via Nix project_path <- \"./sub_shell\" rix_init(   project_path = project_path,   rprofile_action = \"create_missing\" ) }"},{"path":"https://b-rodrigues.github.io/rix/reference/tar_nix_ga.html","id":null,"dir":"Reference","previous_headings":"","what":"tar_nix_ga Run a {targets}  pipeline on Github Actions. — tar_nix_ga","title":"tar_nix_ga Run a {targets}  pipeline on Github Actions. — tar_nix_ga","text":"tar_nix_ga Run {targets}  pipeline Github Actions.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/tar_nix_ga.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"tar_nix_ga Run a {targets}  pipeline on Github Actions. — tar_nix_ga","text":"","code":"tar_nix_ga()"},{"path":"https://b-rodrigues.github.io/rix/reference/tar_nix_ga.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"tar_nix_ga Run a {targets}  pipeline on Github Actions. — tar_nix_ga","text":"Nothing, copies file diretory.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/tar_nix_ga.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"tar_nix_ga Run a {targets}  pipeline on Github Actions. — tar_nix_ga","text":"function puts .yaml file inside .github/workflows/ folders root project. workflow file use projects default.nix file generate development environment Github Actions run projects {targets} pipeline. Make sure give read write permissions Github Actions bot.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/tar_nix_ga.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"tar_nix_ga Run a {targets}  pipeline on Github Actions. — tar_nix_ga","text":"","code":"if (FALSE) {   tar_nix_ga() }"},{"path":"https://b-rodrigues.github.io/rix/reference/with_nix.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate function in R or shell command via nix-shell environment — with_nix","title":"Evaluate function in R or shell command via nix-shell environment — with_nix","text":"function needs installation Nix. with_nix() two effects run code isolated reproducible environments. Evaluate function R shell command via nix-shell environment (Nix expression custom software libraries; involving pinned versions R R packages via Nixpkgs) error, return result object expr with_nix() current R session.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/with_nix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate function in R or shell command via nix-shell environment — with_nix","text":"","code":"with_nix(   expr,   program = c(\"R\", \"shell\"),   exec_mode = c(\"blocking\", \"non-blocking\"),   project_path = \".\",   nix_file = NULL,   message_type = c(\"simple\", \"verbose\") )"},{"path":"https://b-rodrigues.github.io/rix/reference/with_nix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate function in R or shell command via nix-shell environment — with_nix","text":"expr Single R function call, character vector length one shell command possibly options (flags) command invoked. program = R, can use named anonymous function. function provided expr evaluate pass arguments, hence need wrap function call like function() your_fun(arg_a = \"\", arg_b = \"b\"), avoid evaluation make sure expr function (see details examples). program String stating evaluate expression. Either \"R\", default, \"shell\". = \"R\" evaluate expression via RScript = \"shell\" run system command nix-shell. exec_mode Either \"blocking\" (default) \"non-blocking. either block R session expr running nix-shell environment, oor running background (\"non-blocking\"). program = R yield identical results foreground background evaluation (R object), program = \"shell\" return list exit status, standard output standard error system command text blocking mode. project_path Path folder default.nix file resides. default \".\", working directory current R session. approach also useful different subfolders separate software environments defined different default.nix files. prefer run code custom .nix files directory using with_nix(), can use nix_file argument specify paths .nix files. nix_file Path .nix file contains expressions defining Nix software environment want run expr. See project_path argument alternative way specify environment. message_type String detailed output . Currently, either \"simple\" (default) \"verbose\", shows script runs via nix-shell.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/with_nix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate function in R or shell command via nix-shell environment — with_nix","text":"program = \"R\", R object returned function given expr evaluated via R environment nix-shell defined Nix expression. program = \"shell\", list following elements: status: exit code stdout: character vector standard output stderr: character vector standard error expr command sent command line interface provided Nix package.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/with_nix.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Evaluate function in R or shell command via nix-shell environment — with_nix","text":"with_nix() gives power evaluating main function expr function call stack defined current R session encapsulated nix-R session defined Nix expression (default.nix), located distinct project path (project_path). with_nix() convenient gives direct code feedback read-eval-print-loop style, gives direct interface reproducible infrastructure--code approach offered Nix Nixpkgs. need extra efforts setting DevOps tooling like Docker domain specific tools like {renv} control complex software environments R language. example useful following purposes. test compatibility custom R code software/package dependencies development production environments directly stream outputs (returned objects), messages errors command line tool offered Nixpkgs R session. Test evolving R packages change behavior given unchanged R code, whether give identical results . with_nix() can evaluate R code nix-R session within another nix-R session, also host R session (.e., macOS Linux) within specific nix-R session. feature useful testing reproducibility compatibility given code across different software environments. testing different sets environments necessary, can easily providing Nix expressions custom .nix default.nix files different subfolders project. recommended use rix_init() generate custom .Rprofile file subshell project_dir. defaults file ensure R packages Nix store, defined subshell .nix file loaded system's libraries excluded. job, with_nix() heavily relies patterns manipulate language expressions (aka computing language) offered base R well {codetools} package Luke Tierney. key steps done behind scene: recursively find, classify, export global objects (globals) call stack expr well propagate R package environments found. Serialize (save disk) deserialize (read disk) dependent data structures .Rds necessary function arguments provided, relevant globals call stack, packages, expr outputs returned temporary directory. Use pure nix-shell environments execute R code script reconstructed catching expressions quoting; launched commands like via {sys} Jeroen Ooms: nix-shell --pure --run \"Rscript --vanilla\".","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/with_nix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate function in R or shell command via nix-shell environment — with_nix","text":"","code":"if (FALSE) { # create an isolated, runtime-pure R setup via Nix project_path <- \"./sub_shell\" rix_init(   project_path = project_path,   rprofile_action = \"create_missing\" ) # generate nix environment in `default.nix` rix(   r_ver = \"4.2.0\",   project_path = project_path ) # evaluate function in Nix-R environment via `nix-shell` and `Rscript`, # stream messages, and bring output back to current R session out <- with_nix(   expr = function(mtcars) nrow(mtcars),   program = \"R\", exec_mode = \"non-blocking\", project_path = project_path,   message_type = \"simple\" )  # There no limit in the complexity of function call stacks that `with_nix()` # can possibly handle; however, `expr` should not evaluate and  # needs to be a function for `program = \"R\"`. If you want to pass the # a function with arguments, you can do like this get_sample <- function(seed, n) {   set.seed(seed)   out <- sample(seq(1, 10), n)   return(out) }  out <- with_nix(   expr = get_sample(seed = 1234, n = 5),   program = \"R\", exec_mode = \"non-blocking\",   project_path = \".\",   message_type = \"simple\" )  ## You can also attach packages with `library()` calls in the current R  ## session, which will be exported to the nix-R session. ## Other option: running system commands through `nix-shell` environment. }"},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"new-features-0-6-0","dir":"Changelog","previous_headings":"","what":"New features","title":"rix 0.6.0 (2024-02-02)","text":"added nix_file argument alternative project_path. Specify *.nix fle defining Nix software environment want run expr. macOS: made compatible system’s RStudio version macOS, R session can (yet) started shell launched Dock. Now /nix/var/nix/profiles/default/bin added PATH variable with_nix() called. macOS: made compatible system’s RStudio version macOS, R session can (yet) started shell launched Dock. Now /nix/var/nix/profiles/default/bin added PATH variable with_nix() called. added nix_file argument specify specific .nix file","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"user-facing-changes-0-6-0","dir":"Changelog","previous_headings":"","what":"User facing changes","title":"rix 0.6.0 (2024-02-02)","text":"shell_hook = NULL becomes new default; = \"R --vanilla\". new default ensures with_nix() applied specific project_path directory containing custom .Rprofile file generated rix_init(), together default.nix expression file, can read profile file effectively enforce run-time pure R libraries (Nix store).","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-6-0","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.6.0 (2024-02-02)","text":"avoided empty file artefact checking presence nix-build binary. internal helper now uses Sys.(\"nix-build\") checking availability PATH R session. added another guardrail run-time purity Nixpkgs R removing R_LIBS_USER path .libPaths(). Now cleans itermediary output artefacts (files) written Nix shell (nix-shell) session environment exiting. file artefacts now written subdirectory with_nix tempdir() current R session files deleted. Now, expr errors Nix shell evaluation (.e. custom R function), previous successful run different expr /R global environment state success _out.Rds produced, current session fails bring output current R session. code run Nix-R session defined project_path, now attemps record sessionInfo() try. found failures command older R versions Nixpkgs macOS (.e., aarch64-darwin). Fix segmentation faults tests temporarily setting LD_LIBRARY_PATH. Patched import glibcLocalesUtf8 gibcLocales (imports locales). necessary support Nixpkgs R versions <= 4.2.0, glibcLocalsUtf8 derivation yet available. sacrifice reproducibility rather larger total sizes derivations involved subshell (around 200MB extra).","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"quality-and-unit-testing-0-6-0","dir":"Changelog","previous_headings":"","what":"Quality and unit testing","title":"rix 0.6.0 (2024-02-02)","text":"added test suite 17 unit tests using {testthat} Add GitHub actions runners repository use system’s R Nix R environments configured Nix.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"internal-refactoring-0-6-0","dir":"Changelog","previous_headings":"","what":"Internal refactoring","title":"rix 0.6.0 (2024-02-02)","text":"nix_build(): consistently separate cmd args nix-build system","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-0519000-2024-01-17","dir":"Changelog","previous_headings":"","what":"rix 0.5.1.9000 (2024-01-17)","title":"rix 0.5.1.9000 (2024-01-17)","text":"Added rix::init() initialize maintain isolated, project-specific, pure R setup via Nix. accomplishes writing custom .Rprofile guarantees R packages can attached Nix paths, preventing unnoticed loading system’s R user library (R_LIBS_USER ensuring runtime purity regarding packages linked libraries). Additionally, appends /nix/var/nix/profiles/default/bin PATH. Currently, modification takes effect current R session new R sessions RStudio MacOS. default R session started shell. PATH modified RStudio starting R session, effectively loading local .Rprofile. Future versions RStudio hopefully respect environmental variables shell environment.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-5-1","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.5.1 (2024-01-16)","text":"rix::rix(): patch nixpkgs revisions corresponding R (r_ver) <= 4.2.0; nix-build failed attribute glibcLocalesUtf8 found. Fixed importing gibcLocales. Thanks @motorlearner reporting.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"features-0-5-0","dir":"Changelog","previous_headings":"","what":"Features","title":"rix 0.5.0 (2024-01-07)","text":"Added with_nix(), can evaluate function R shell command via nix-shell environment, return output current R session. works evaluating R code nix-R session within nix-R session, also host R session (.e., macOS linux) within specific nix-R session. feature useful test dependencies specific setups software controlled environments. Added tar_nix_ga(), function run targets pipelines Github Actions using Nix expression.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-4-1","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.4.1 (2023-10-06)","text":"rix::rix(): fix missing pkgs.mkShell shell_hook = NULL. shell_hook = \"\" shell_hook = NULL now producing valid nix expressions.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"features-0-4-0","dir":"Changelog","previous_headings":"","what":"Features","title":"rix 0.4.0 (2023-09-26)","text":"rix::rix() now defaults \"en_US.UTF-8\" relevant locale variables (LANG, LC_ALL, LC_TIME, LC_MONETARY, LC_PAPER, LC_MEASUREMENT) sets environment variables Nix shell. correctly propagated Nix R session. Users can modify locale setting via options(rix.nix_locale_variables = list(LANG = \"de_CH.UTF-8\", <...>), e.g., needs UTF-8 locale. import glibcLocalesUtf8 subset, keep size reasonable.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-4-0","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.4.0 (2023-09-26)","text":"fix locale warnings starting R linux, uses glibc (closes #50). Now, use glibcLocalesUtf8 Nix “x86_64-linux”.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"chore-0-3-1","dir":"Changelog","previous_headings":"","what":"Chore","title":"rix 0.3.1 (2023-09-11)","text":"Remove boilerplate code rix::rix(tex_pkgs = NULL)","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-030-2023-09-10","dir":"Changelog","previous_headings":"","what":"rix 0.3.0 (2023-09-10)","title":"rix 0.3.0 (2023-09-10)","text":"Added support installing TeX Live packages via new rix::rix() argument tex_pkgs.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"chore-0-3-0","dir":"Changelog","previous_headings":"","what":"Chore","title":"rix 0.3.0 (2023-09-10)","text":"update inst/extdata/default.nix installs {rix} v0.3.0.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-0219002-2023-09-02","dir":"Changelog","previous_headings":"","what":"rix 0.2.1.9002 (2023-09-02)","title":"rix 0.2.1.9002 (2023-09-02)","text":"nix_build() now supports --max_jobs flag nix-build via options(rix.nix_build_max_jobs = ). Custom settings option can useful leveraging full /O latency efficient builds shared memory multiprocessing systems.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-0219001-2023-08-29","dir":"Changelog","previous_headings":"","what":"rix 0.2.1.9001 (2023-08-29)","title":"rix 0.2.1.9001 (2023-08-29)","text":"Include nix_build() interactive use vignette (#68).","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"chore-0-2-1-9000","dir":"Changelog","previous_headings":"","what":"Chore","title":"rix 0.2.1.9000 (2023-08-29)","text":"Fix internal create_default_nix() project_path directory name. Updated inst/extdata/default.nix latest commit {rix} prior bumping.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-2-1","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.2.1 (2023-08-26)","text":"Patch rix() allow empty r_pkgs (##67). Patch rix() bug-free calling rix_build() within default nix shell.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"chore-0-2-1","dir":"Changelog","previous_headings":"","what":"Chore","title":"rix 0.2.1 (2023-08-26)","text":"New internal helper create_default_nix() bootstrap ./inst/extdata/default.nix","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"new-features-0-2-0","dir":"Changelog","previous_headings":"","what":"New features","title":"rix 0.2.0 (2023-08-25)","text":"Updated Nix historical revision data include R version 4.3.1. Provision new shell_hook arg rix::rix(), create shellHook entry default.nix.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-2-0","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.2.0 (2023-08-25)","text":"inst/extdata/default.nix: use R --vanilla shellHook propagate user-specific .Renviron .Rprofile. Fixes #56","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-1-2","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.1.2 (2023-08-14)","text":"Patch inst/exdata/default.nix LOCALE_ARCHIVE shellHook set glibc locale fail MacOS anymore (#40; fixed 37f7ab8). nix_build(): fix defensive check error message referring project_path instead nix_file. patch change correct behavior nix_build(), hence cosmetic nature.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-1-1","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.1.1 (2023-08-11)","text":"nix_build() now correctly checks presence nix-build. (4be69b2)","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"new-features-0-1-0","dir":"Changelog","previous_headings":"","what":"New features","title":"rix 0.1.0 (2023-08-11)","text":"Added nix_build() helper runs nix-build interactively R. (#22) rix() now supports installing packages GitHub CRAN archives. rix() now supports using nixpkgs revision instead R version reproducibility Generated default.nix files now also include call made generate top-level comment.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"changes-0-1-0","dir":"Changelog","previous_headings":"","what":"Changes","title":"rix 0.1.0 (2023-08-11)","text":"path argument rix() changed project_path.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-development-version","dir":"Changelog","previous_headings":"","what":"rix (development version)","title":"rix (development version)","text":"Basic functionality added.","code":""}]