From b8fb7914e1ef59f985611a9cbcf5da8eb3a1c011 Mon Sep 17 00:00:00 2001 From: b-rodrigues Date: Thu, 8 Aug 2024 14:45:17 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20b-rodrig?= =?UTF-8?q?ues/rix@eed47b1acb06f9143bd49bbfe5b02a33dd9773c1=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../c-using-rix-to-build-project-specific-environments.html | 4 ++-- ...nced-topic-reproducible-analytical-pipelines-with-nix.html | 2 +- ...-advanced-topic-running-r-or-shell-code-in-nix-from-r.html | 2 +- pkgdown.yml | 2 +- search.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) 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 939cad27..cdb5d4f7 100644 --- a/articles/c-using-rix-to-build-project-specific-environments.html +++ b/articles/c-using-rix-to-build-project-specific-environments.html @@ -235,12 +235,12 @@

Running old projects with {rix}#> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #> #> ==> Existing isolated nix-R project folder: -#> /tmp/Rtmp9nGTmz +#> /tmp/RtmpPmK8dU #> #> * current R session running outside Nix environment and not from RStudio #> #> ==> Added `.Rprofile` file and code lines for new R sessions launched from: -#> /tmp/Rtmp9nGTmz +#> /tmp/RtmpPmK8dU #> #> * 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 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 b2ec0090..945a48fc 100644 --- a/articles/z-advanced-topic-reproducible-analytical-pipelines-with-nix.html +++ b/articles/z-advanced-topic-reproducible-analytical-pipelines-with-nix.html @@ -117,7 +117,7 @@

An example o )

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

-
#> # This file was generated by the {rix} R package v0.9.1 on 2024-07-30
+
#> # This file was generated by the {rix} R package v0.9.1 on 2024-08-08
 #> # 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 16420038..ddf348af 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
@@ -190,7 +190,7 @@ 

Setting up the (R) softw #> ### Successfully generated `default.nix` and `.Rprofile` ###

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.9.1 on 2024-07-30
+
#> # This file was generated by the {rix} R package v0.9.1 on 2024-08-08
 #> # with following call:
 #> # >rix(r_ver = "6e3a86f2f73a466656a401302d3ece26fba401d9",
 #> #  > project_path = path_env_1,
diff --git a/pkgdown.yml b/pkgdown.yml
index 1a44626b..0478fb77 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -17,7 +17,7 @@ articles:
   z-binary_cache: z-binary_cache.html
   z-bleeding_edge: z-bleeding_edge.html
   z-contributing_to_nixpkgs: z-contributing_to_nixpkgs.html
-last_built: 2024-07-30T18:14Z
+last_built: 2024-08-08T14: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 58cad991..fb727af0 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":[]},{"path":"https://b-rodrigues.github.io/rix/CONTRIBUTING.html","id":"development-environment","dir":"","previous_headings":"","what":"Development environment","title":"Contributing","text":"provide default.nix file defines right development environment already Nix user wish contribute package. development environment provide bleeding edge packages, uses fork nixpkgs gets updated daily (R packages included). environment bleeding edge, pre-built binaries available chache.nixos.org, building environment locally quite time-consuming. speed-process, also provide cache environment also gets updated several times day. use cache, need cachix installed configured. wish use development environment associated cache quickly right environment contribute package, run following steps: First, install cachix: nix-env -iA cachix -f https://cachix.org/api/v1/install Enable cache: cachix use rstats--nix might get error message stating user use caches. Simply follow instructions warning give right permissions user use caches. , run nix-build, binaries pulled rstats--nix.cachix.org cache.nixos.org. Building development environment nothing waiting packages download. also possibility successfully build development environment: nixpkgs fork gets updated fully automatically several times day without checks, building package fails, fix released yet. build development environment, please open issue, propose fix upstream.","code":""},{"path":"https://b-rodrigues.github.io/rix/CONTRIBUTING.html","id":"fledge","dir":"","previous_headings":"","what":"{fledge}","title":"Contributing","text":"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/rix/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":"non-technical-intro-to-nix","dir":"Articles","previous_headings":"","what":"Non-technical intro to Nix","title":"a - Getting started","text":"familiar concept package managers, can skip next section. ensure project reproducible need deal least four things: Make sure required/correct version R (language) installed; Make sure required versions packages installed; Make sure system dependencies installed (example, ’d need working Java installation install rJava R package Linux); Make sure can install hardware hand. three first bullet points, consensus seems mixture Docker deal system dependencies, renv packages (groundhog, fixed CRAN snapshot like Posit provides) R installation manager install correct version R (unless use Docker image base already ships required version default). last point, way able compile software target architecture. ’s lot moving pieces, knowledge need get right. turns solution. Docker + renv (way deal packages) likely popular way ensure reproducibility projects, tools achieve . One tool called Nix. Nix package manager Linux distributions, macOS even works Windows enable WSL2. ’s package manager? ’re Linux user, may aware. Let explain way: R, want install package provide functionality included vanilla installation R, ’d run : turns Linux distributions, like Ubuntu example, work similar way, software ’d usually install using installer (least Windows). example install Firefox Ubuntu using: (’s also graphical interfaces make process “user-friendly”). Linux jargon, packages simply call software (guess ’s “apps” days). packages get downloaded -called repositories (think CRAN, repository R packages) type software might need make computer work: web browsers, office suites, multimedia software . Nix just another package manager can use install software. interests us using Nix install Firefox, instead install R R packages require analysis (programming language need). use Nix instead usual ways install software operating systems? first thing know Nix’s repository, nixpkgs, huge. Humongously huge. ’m writing lines, ’s 100’000 pieces software available, entirety CRAN also available nixpkgs. instead installing R usually use install.packages() install packages, use Nix handle everything. still, use Nix ? Nix interesting feature: using Nix, possible install software (relatively) isolated environments. using Nix, can install many versions R R packages need. Suppose start working new project. start project, Nix, install project-specific version R R packages use particular project. switch projects, ’d switch versions R R packages. familiar renv, see exactly thing: difference project-specific library R packages, also project-specific R version. start project now, ’d R version 4.2.3 installed (latest version available nixpkgs latest version available, later), accompagnying versions R packages, long project lives (can long time). start project next year, project R, maybe R version 4.4.2 something like , set required R packages current time. Nix always installs software need separate, (isolated) environments computer. can define environment one specific project. Nix goes even : can install R R packages using Nix (isolated) project-specific environments, Nix even installs required system dependencies. example need rJava, Nix make sure install correct version Java well, always project-specific environment (already Java version installed system, won’t interference). ’s also pretty awesome, can use specific version nixpkgs always get exactly versions software whenever build environment run project’s code. environment gets defined simple plain-text file, anyone using file build environment get exactly, byte byte, environment initially started project. also regardless operating system used.","code":"install.packages(\"dplyr\") sudo apt-get install firefox"},{"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 100.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. example, already R installed, user library R packages, caution required properly use environments managed Nix. important stage understand call install.packages() running Nix environment. want add packages Nix environment analyzing data, need add default.nix expression rebuild environment. explained greater detail vignette(\"d1-installing-r-packages---nix-environment\"). avoid interference main R library packages Nix environments, calling rix() also run rix_init(), create custom .Rprofile project’s directory. .Rprofile ensure user library packages, won’t get loaded R version running Nix shell. also redefine install.packages() throw error try use . 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 local packages .tar.gz format install; 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 install packages dedicated folder computer, called Nix store. Nix done building environment, can start working interactively using following command terminal emulator (R console): drop Nix shell provides installed software. mandatory call nix-build first: can immediately call nix-shell. advantage using nix-build first create file called result prevent environment get garbage collected clean Nix store. want build environment older version R, might get warning telling build expression, can directly drop . want completely isolate Nix environment rest system, recommend using nix-shell --pure drop environment, described documentation rix_init(). Finally, want delete environment, delete result file first (used nix-build) call nix-store --gc, delete orphaned packages. 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 . can’t install Nix system, R already installed, can skip last section vignette simply install rix package.","code":""},{"path":[]},{"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":"Installing Nix","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: open /etc/wsl.conf nano, command line text editor. Add following line: Save file CTRL-O quit nano CTRL-X. , type following line powershell: relaunch WSL (Ubuntu) start menu. 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 [boot] systemd=true wsl --shutdown"},{"path":"https://b-rodrigues.github.io/rix/articles/b1-setting-up-and-using-rix-on-linux-and-windows.html","id":"the-determinate-systems-installer","dir":"Articles","previous_headings":"Installing Nix","what":"The Determinate Systems installer","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":"case-1-you-dont-have-r-installed-and-wish-to-install-it-using-nix-as-well","dir":"Articles","previous_headings":"","what":"Case 1: you don’t have R installed and wish to install it using Nix as well","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. Beware already default.nix file working directory, running rix() overwrite = TRUE argument overwrite ! make sure using version control system projects avoid bad surprises. details managing project-specific default.nix detailled vignette vignette(\"d1-installing-r-packages---nix-environment\") vignette(\"d2-installing-system-tools--texlive-packages---nix-environment\"). also include rix project-specific environments, generating default.nix like : Change commit recent one adapt project_path argument needed.","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 ) rix(   r_ver = \"latest\",   r_pkgs = NULL,   git_pkgs = list(     package_name = \"rix\",     repo_url = \"https://github.com/b-rodrigues/rix\",     commit = \"76d1bdd03d78589d399b4b9d473ecde616920a82\"   ),   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":"case-2-you-have-r-installed-through-your-oss-package-manager","dir":"Articles","previous_headings":"","what":"Case 2: you have R installed through your OS’s package manager","title":"b1 - Setting up and using rix on Linux and Windows","text":"installed R system usual means installation (Nix, decribed ), can install rix package usual well. 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, running rix() also runs rix_init() creates custom .Rprofile project’s path. custom .Rprofile ensure packages declaratively defined default.nix built part Nix store (one R package one separate derivation listed unique Nix path) appear R library path.","code":""},{"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 Nix 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.7.1 on 2024-07-01 #> # with following call: #> # >rix(r_ver = \"12a9c0004bc987afb1ff511ebb97b67497a68e22\", #> #  > 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 12a9c0004bc987afb1ff511ebb97b67497a68e22 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/12a9c0004bc987afb1ff511ebb97b67497a68e22.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 ) #>  #> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #>  #> ==> Existing isolated nix-R project folder: #>  /tmp/Rtmp9nGTmz  #>  #> * current R session running outside Nix environment and not from RStudio #>  #> ==> Added `.Rprofile` file and code lines for new R sessions launched from: #> /tmp/Rtmp9nGTmz #>  #> * 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 #>  #> ==> Also adjusting `PATH` via `Sys.setenv()`, so that system commands can invoke key Nix commands like `nix-build` in this RStudio session outside Nix #>  #>  #> ### Successfully generated `default.nix` and `.Rprofile` ### #> # This file was generated by the {rix} R package v0.7.1 on 2024-07-01 #> # with following call: #> # >rix(r_ver = \"79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a\", #> #  > r_pkgs = c(\"dplyr\", #> #  > \"janitor\"), #> #  > 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)  #>       quarto #>       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   ]; #>    #> }"},{"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. context R programming language, means user system library packages (meaning, library packages generated regular installation R), packages may loaded R version running Nix shell. avoid issues , calling rix() automatically runs rix_init() well, generates custom .Rprofile file project’s directory. way, regular user library packages interfere R environments managed Nix. Moreover, custom .Rprofile also redefines install.packages() makes throw error: indeed, wish add packages R environment managed Nix, add packages default.nix file instead, rebuild environment. want even make programs inaccessible running Nix environment, can drop using nix-shell --pure instead nix-shell.","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":"a-word-of-caution","dir":"Articles","previous_headings":"","what":"A word of caution","title":"d1 - Installing R packages in a Nix environment","text":"important stage understand call install.packages() running Nix environment. want add packages analyzing data, need add default.nix expression rebuild environment. goes installing packages Github; use method described vignette instead using something like remotes::install_github(). recommend create script called create_env.R similar, add call rix() : , add packages need r_pkgs run script . , build environment using nix-build , drop using nix-shell. Calling install.packages() bad idea several reasons: goes idea defining environment declarative way. able add packages using install.packages(), environment end state default.nix definition environment actual environment don’t match anymore. using install.packages() likely simply work, , cause issues. example, call install.packages(\"ggplot2\") one Nix shell, install ggplot2 “inside” Nix shell, install user’s system library packages. Nix shell changed run-time, , R instead install packages user’s library. version ggplot2, system-wide library packages, available Nix shell. call install.packages(\"ggplot2\") another Nix shell, say 6 months later, replace first version ggplot2 latest version. Ideally, manage R versions R packages using Nix, uninstall system-managed version R R packages. wish keep system-managed version R R packages, highly recommend call rix_init() Nix shells. ensure Nix projects system library packages don’t interfere .","code":"library(rix)  rix(r_ver = \"4.4.0\",     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/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.7.1 on 2024-07-01 #> # 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; however branch name required, commit enough pin exact version code needed. fusen package also installed, commit d617172447d.","code":"path_default_nix <- tempdir()  rix(   r_ver = \"4.2.1\",   r_pkgs = c(\"dplyr\", \"janitor\"),   git_pkgs = list(     list(       package_name = \"housing\",       repo_url = \"https://github.com/rap4all/housing/\",       commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"     ),     list(       package_name = \"fusen\",       repo_url = \"https://github.com/ThinkR-open/fusen\",       commit = \"d617172447d2947efb20ad6a4463742b8a5d79dc\"     )   ),   ide = \"other\",   project_path = path_default_nix,   overwrite = TRUE )"},{"path":"https://b-rodrigues.github.io/rix/articles/d1-installing-r-packages-in-a-nix-environment.html","id":"installing-local-archives","dir":"Articles","previous_headings":"","what":"Installing local archives","title":"d1 - Installing R packages in a Nix environment","text":"also possible install packages local tar.gz file. , place package folder default.nix generated, write something like : assumes chronicler_0.2.1.tar.gz knitr_1.43.tar.gz downloaded beforehand. want include local package developing, make sure first build using devtools::build() build .tar.gz archive, can, consider uploading source code package Github installing Github instead.","code":"rix(   r_ver = \"4.3.1\",   local_r_pkgs = c(\"chronicler_0.2.1.tar.gz\", \"knitr_1.43.tar.gz\"),   overwrite = TRUE )"},{"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":"path_default_nix <- tempdir()  rix(   r_ver = \"4.2.1\",   r_pkgs = c(\"dplyr\", \"janitor\", \"AER@1.2-8\"),   git_pkgs = list(     list(       package_name = \"housing\",       repo_url = \"https://github.com/rap4all/housing/\",       commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"     ),     list(       package_name = \"fusen\",       repo_url = \"https://github.com/ThinkR-open/fusen\",       commit = \"d617172447d2947efb20ad6a4463742b8a5d79dc\"     )   ),   ide = \"other\",   project_path = path_default_nix,   overwrite = TRUE ) #> # This file was generated by the {rix} R package v0.7.1 on 2024-07-01 #> # with following call: #> # >rix(r_ver = \"79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a\", #> #  > r_pkgs = c(\"dplyr\", #> #  > \"janitor\", #> #  > \"AER@1.2-8\"), #> #  > git_pkgs = list(list(package_name = \"housing\", #> #  > repo_url = \"https://github.com/rap4all/housing/\", #> #  > commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"), #> #  > list(package_name = \"fusen\", #> #  > repo_url = \"https://github.com/ThinkR-open/fusen\", #> #  > commit = \"d617172447d2947efb20ad6a4463742b8a5d79dc\")), #> #  > ide = \"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/\"; #>         rev = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"; #>         sha256 = \"sha256-s4KGtfKQ7hL0sfDhGb4BpBpspfefBN6hf+XlslqyEn4=\"; #>       }; #>       propagatedBuildInputs = builtins.attrValues { #>         inherit (pkgs.rPackages)  #>           dplyr #>           ggplot2 #>           janitor #>           purrr #>           readxl #>           rlang #>           rvest #>           stringr #>           tidyr; #>       }; #>     }) #>  #>  #>     (pkgs.rPackages.buildRPackage { #>       name = \"fusen\"; #>       src = pkgs.fetchgit { #>         url = \"https://github.com/ThinkR-open/fusen\"; #>         rev = \"d617172447d2947efb20ad6a4463742b8a5d79dc\"; #>         sha256 = \"sha256-TOHA1ymLUSgZMYIA1a2yvuv0799svaDOl3zOhNRxcmw=\"; #>       }; #>       propagatedBuildInputs = builtins.attrValues { #>         inherit (pkgs.rPackages)  #>           attachment #>           cli #>           desc #>           devtools #>           glue #>           here #>           magrittr #>           parsermd #>           roxygen2 #>           stringi #>           tibble #>           tidyr #>           usethis #>           yaml; #>       }; #>     }) #>   #>     (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":"100’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 )"},{"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.7.1 on 2024-07-01 #> # with following call: #> # >rix(r_ver = \"12a9c0004bc987afb1ff511ebb97b67497a68e22\", #> #  > 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 12a9c0004bc987afb1ff511ebb97b67497a68e22 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/12a9c0004bc987afb1ff511ebb97b67497a68e22.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) #>       quarto #>       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 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: also R installed usual method operating system, also system user library packages. library packages interfere library packages R environments managed Nix. avoid , running rix() writes default.nix file project’s path, also custom .Rprofile file well calling rix_init(). .Rprofile prevent clashes user library packages Nix environments’ library packages. Navigate folder using terminal, run nix-build build environment, nix-shell. dropped Nix shell. can also use nix-shell --pure instead, want increase isolation Nix-R environments. difference environment started nix-shell, still able access programs system, nix-shell --pure, programs installed Nix-R environment available. Try something like wget shell started nix-shell shell started nix-shell --pure example (replace wget tool installed computer). 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. , need use rix_init() won’t clash user library R packages (since don’t ), R environments managed Nix.","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 ) 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 ) 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 )"},{"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/\";        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/\";       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/\",     commit = \"eba63db477dd2f20153b75e2949eb333a36cccfc\"   ),   ide = \"other\",   project_path = path_default_nix,   overwrite = TRUE,   print = TRUE ) 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 path_default_nix <- tempdir()  rix(   r_ver = \"latest\",   r_pkgs = NULL,   system_pkgs = NULL,   git_pkgs = list(     package_name = \"highlite\",     repo_url = \"https://github.com/jimhester/highlite/\",     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/\";     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/\";       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/\";       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/\",     commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"   ),   ide = \"other\",   project_path = path_default_nix,   overwrite = TRUE ) #> # This file was generated by the {rix} R package v0.9.1 on 2024-07-30 #> # 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/\", #> #  > 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/\"; #>         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()'\" 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/\",     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, write default.nix file containing Nix expressions pin R version 4.1.3 Nixpkgs. following expression written default.nix subfolder ./_env_1_R-4-1-3/. also includes custom .Rprofile file ensure subshell load packages installed user’s library packages.","code":"library(\"rix\")  path_env_1 <- file.path(\".\", \"_env_1_R-4-1-3\")  rix(   r_ver = \"4.1.3\",   overwrite = TRUE,   project_path = path_env_1 ) #>  #> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #>  #> ==> Existing isolated nix-R project folder: #>  /home/runner/work/rix/rix/vignettes/_env_1_R-4-1-3  #>  #> * current R session running outside Nix environment and not 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 #>  #> ==> Also adjusting `PATH` via `Sys.setenv()`, so that system commands can invoke key Nix commands like `nix-build` in this RStudio session outside Nix #>  #>  #> ### Successfully generated `default.nix` and `.Rprofile` ### #> # This file was generated by the {rix} R package v0.9.1 on 2024-07-30 #> # 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":"now 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. 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\",   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\",   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(   r_ver = \"4.2.0\",   overwrite = TRUE,   project_path = path_env_1_2,   shell_hook = \"R\" ) #>  #> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #>  #> ==> Existing isolated nix-R project folder: #>  /home/runner/work/rix/rix/vignettes/_env_1_2_R-4-2-0  #>  #> * current R session running outside Nix environment and not 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 #>  #> ==> Also adjusting `PATH` via `Sys.setenv()`, so that system commands can invoke key Nix commands like `nix-build` in this RStudio session outside Nix #>  #>  #> ### Successfully generated `default.nix` and `.Rprofile` ###  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\",   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: 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(   r_ver = \"4.3.1\",   r_pkgs = \"stringr@1.4.1\",   overwrite = TRUE,   project_path = path_env_stringr ) #>  #> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #>  #> ==> Existing isolated nix-R project folder: #>  /home/runner/work/rix/rix/vignettes/_env_stringr_1.4.1  #>  #> * current R session running outside Nix environment and not 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 #>  #> ==> Also adjusting `PATH` via `Sys.setenv()`, so that system commands can invoke key Nix commands like `nix-build` in this RStudio session outside Nix #>  #>  #> ### Successfully generated `default.nix` and `.Rprofile` ###  list.files(path = path_env_stringr, all.files = TRUE) #> [1] \".\"           \"..\"          \".Rprofile\"   \"default.nix\" out_nix_stringr <- with_nix(   expr = function() stringr::str_subset(c(\"\", \"a\"), \"\"),   program = \"R\",   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(   r_ver = \"4.1.1\",   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\",   project_path = path_env_arrow,   message_type = \"simple\" )"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-using-nix-inside-docker.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"z - Advanced topic: Using Nix inside Docker","text":"might look like Nix alternative Docker, ’s really case. Docker containerisation tool, Nix package manager. can use Nix way don’t need Docker anymore, ’re already invested Docker, don’t abandon can still benefit Nix.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-using-nix-inside-docker.html","id":"a-generic-dockerfile","dir":"Articles","previous_headings":"","what":"A generic Dockerfile","title":"z - Advanced topic: Using Nix inside Docker","text":"Dockerfile uses ubuntu:latest base image, uses Nix package manager set complete development environment: doesn’t matter using ubuntu:latest base image, usually recommended reproducibility purposes, since Nix takes care ensuring environment reproducible. example generate_env.R file: Using Nix handle setup environment, even inside Docker, creates nice separation concerns. one hand, can continue using Docker serve applications, hand, can use Nix ensure don’t store images, can always rebuild correct environment completely reproducible manner.","code":"FROM ubuntu:latest  RUN apt update -y  RUN apt install curl -y  # We don't have R nor {rix} in this image, so we can bootstrap it by downloading # the default.nix file that comes with {rix}. You can also download it beforehand # and then copy it to the Docker image RUN curl -O https://raw.githubusercontent.com/b-rodrigues/rix/master/inst/extdata/default.nix  # Copy a script to generate the environment of interest using {rix} COPY generate_env.R .  # The next 4 lines install Nix inside Docker. See the Determinate Systems installer's documentation RUN curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux \\   --extra-conf \"sandbox = false\" \\   --init none \\   --no-confirm  # Adds Nix to the path, as described by the Determinate Systems installer's documentation ENV PATH=\"${PATH}:/nix/var/nix/profiles/default/bin\"  # This will overwrite the default.nix we downloaded previously with a new # expression generated from running `generate_env.R` RUN nix-shell --run \"Rscript generate_env.R\"  # We now build the environment RUN nix-build  # Finally, we run `nix-shell`. This will get executed when running # containers from this image. You can of course put anything in here CMD nix-shell library(rix)  rix(   r_ver = \"4.3.1\",   r_pkgs = c(\"dplyr\", \"ggplot2\"),   ide = \"other\",   project_path = \".\",   shell_hook = \"R\",   overwrite = TRUE )"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-using-nix-inside-docker.html","id":"dockerizing-a-shiny-application","dir":"Articles","previous_headings":"","what":"Dockerizing a Shiny application","title":"z - Advanced topic: Using Nix inside Docker","text":"Dockerizing Shiny application using Nix easy well. can keep almost exactly Dockerfile , need add required ui.R server.R files (files needed app), expose port want: adapt generate_env.R script: code simple Shiny app (’s K-means app Shiny examples gallery): ui.R: server.R: Build image : run container :","code":"FROM ubuntu:latest  RUN apt update -y  RUN apt install curl -y  # Get a default.nix with R and rix RUN curl -O https://raw.githubusercontent.com/b-rodrigues/rix/master/inst/extdata/default.nix  # Copy a script to generate the environment of interest using rix COPY generate_env.R .  # Copy the required scripts for the app COPY ui.R . COPY server.R .  RUN curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux \\   --extra-conf \"sandbox = false\" \\   --init none \\   --no-confirm  ENV PATH=\"${PATH}:/nix/var/nix/profiles/default/bin\"  # This will overwrite the default.nix we downloaded with a new one RUN nix-shell --run \"Rscript generate_env.R\"  EXPOSE 3838  RUN nix-build  CMD nix-shell --run 'Rscript -e \"shiny::runApp(port = 3838, host = \\\"0.0.0.0\\\")\"' library(rix)  rix(   r_ver = \"4.2.2\",   r_pkgs = \"shiny\",   ide = \"other\",   project_path = \".\",   overwrite = TRUE ) # k-means only works with numerical variables, # so don't give the user the option to select # a categorical variable vars <- setdiff(names(iris), \"Species\")  pageWithSidebar(   headerPanel(\"Iris k-means clustering\"),   sidebarPanel(     selectInput(\"xcol\", \"X Variable\", vars),     selectInput(\"ycol\", \"Y Variable\", vars, selected = vars[[2]]),     numericInput(\"clusters\", \"Cluster count\", 3, min = 1, max = 9)   ),   mainPanel(     plotOutput(\"plot1\")   ) ) function(input, output, session) {   # Combine the selected variables into a new data frame   selectedData <- reactive({     iris[, c(input$xcol, input$ycol)]   })    clusters <- reactive({     kmeans(selectedData(), input$clusters)   })    output$plot1 <- renderPlot({     palette(c(       \"#E41A1C\", \"#377EB8\", \"#4DAF4A\", \"#984EA3\",       \"#FF7F00\", \"#FFFF33\", \"#A65628\", \"#F781BF\", \"#999999\"     ))      par(mar = c(5.1, 4.1, 0, 1))     plot(selectedData(),       col = clusters()$cluster,       pch = 20, cex = 3     )     points(clusters()$centers, pch = 4, cex = 4, lwd = 4)   }) } docker build -t shiny_app . docker run --rm -p 3838:3838 --name my_container shiny_app"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-using-nix-inside-docker.html","id":"nixos","dir":"Articles","previous_headings":"","what":"NixOS","title":"z - Advanced topic: Using Nix inside Docker","text":"can also image NixOS Docker image instead Ubuntu, case don’t need install Nix. NixOS full GNU/Linux distribution uses Nix system package manager.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-binary_cache.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"z - Advanced topic: Rolling out your own binary cache","text":"core, Nix package manager installs software source, can take long time. example, installing R RStudio source take several hours, depending hardware. R packages also must compiled, depending environment need, take several hours build. practice however, rarely case , packages get pre-built made available NixOS’s public cache. Nix package manager first checks need public cache, yes, downloads binary instead building computer. means building environment just matter waiting packages download. However, cases, might need use packages pre-built cached yet, example use rix(r_ver = \"bleeding_edge\") rix(r_ver = “frozen_edge”)` generate environments bleeding edge packages. Building environments potentially take quite long, packages need built source computer. vignette explain can cut building times building environment , cache , don’t need rebuild new machines. rolling cache, try using explained vignette(\"z-bleeding_edge\"), cache didn’t cover needs, set . vignette explains .","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-binary_cache.html","id":"using-github-actions-to-build-the-environment","dir":"Articles","previous_headings":"","what":"Using Github Actions to build the environment","title":"z - Advanced topic: Rolling out your own binary cache","text":"creating cache hold binaries development environment, first need build environment . can build environment computer, Github Actions. advantage using Github Actions can automate process building pushing binaries time change definition environment. example, imagine following generate_env.R file project, version Github: add packages , re-run , ’ll end new default.nix file, need rebuild environment. , depending packages include, take quite time build. generate Github Actions workflow file build environment Github Actions, run rix::ga_cachix(cache_name = \"\", path = \"\") cache_name name cache made Cachix, path path default.nix file generated generate_env.R. default, environment gets rebuilt every time push changes master/main branch repository, can also re-build environment periodically, changing lines: : using cron syntax can specify often want environment re-built. can useful need develop current state CRAN every day (instance, package development).","code":"library(rix)  rix(r_ver = \"bleeding_edge\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     tex_pkgs = NULL,     ide = \"rstudio\",     project_path = \".\") on:   push:     branches: [ master, main ] on:   push:     branches: [ master, main ]   schedule:     - cron: '30 0 * * *'"},{"path":"https://b-rodrigues.github.io/rix/articles/z-binary_cache.html","id":"using-your-cache","dir":"Articles","previous_headings":"","what":"Using your cache","title":"z - Advanced topic: Rolling out your own binary cache","text":"Whether decide build packages Github locally, use cache, need open account Cachix. free tier includes 5GB space, enough several development environments. account done, create personal auth token Github Actions workflow (computer, building locally) can authenticate Cachix account. , copy token, go Github repository’s settings, Secrets variables > Actions add new repository secret. Copy token Secret field name secret CACHIX_AUTH. Now action can authenticate Cachix push binaries builds! building locally, simply run cachix authtoken  terminal building (follow instructions Cachix website learn push binaries afterwards). use personalized cache computers, run following commands computer. First, install Cachix client: use cache: Anyone can pull binaries cache, work team, can ensure everyone can benefit . can also use several caches , NixOS’s public cache, rstats--nix cache, , cache end holding binaries found two caches! Take look package’s repository example done practice.","code":"nix-env -iA cachix -f https://cachix.org/api/v1/install cachix use your-cache-name"},{"path":"https://b-rodrigues.github.io/rix/articles/z-bleeding_edge.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"z - Advanced topic: Understanding the rPackages set release cycle and using bleeding edge packages","text":"important understand release cycle rPackages set steps take need bleeding edge packages. R packages nixpkgs tend get updated alongside new release R, reason ensure certain level quality. vast majority CRAN (Bioconductor) packages made available nixpkgs fully automated way. packages require manual intervention work Nix, know try build packages, building packages requires quite lot resources. can’t build CRAN packages every single day see everything works well Nix, rebuild whole tree whenever ’s new release R. Packages get built CI infrastructure called Hydra, packages get cached cache.nixos.org whenever someone wants install package, pre-built binary gets download cache. avoids build software source locally. packages don’t need compiling big time save, packages need get compiled huge. Depending packages want install, build everything source, potentially take hours, can install pre-built binaries ’s just matter quick internet connection .","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-bleeding_edge.html","id":"r-packages-available-through-nix","dir":"Articles","previous_headings":"","what":"R packages available through Nix","title":"z - Advanced topic: Understanding the rPackages set release cycle and using bleeding edge packages","text":"explained introduction, rPackages set nixpkgs gets updated shortly new release R. process involves first updating package definitions found , building whole tree CI platform called Hydra. Build failures get fixed volunteers (learn can contribute, read vignette(\"z-contributing_to_nixpkgs\")). important packages fixed, whole rPackages set gets updated made available nixpkgs master branch. Essentially means start project rix using \"latest\" r_ver just rPackages set got updated, project use fresh packages. instead start project just R release, environment using older packages. practice rarely matters, unless absolutely need recent version specific package need specific feature, need environment bleeding edge packages development. cases like , provide r_ver = \"bleeding_edge\" r_ver = \"frozen_edge\" options makes possible use recent packages environment, cost. must aware cost detail next section.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-bleeding_edge.html","id":"using-bleeding-and-frozen-edge-package-for-your-environments","dir":"Articles","previous_headings":"","what":"Using bleeding and frozen edge package for your environments","title":"z - Advanced topic: Understanding the rPackages set release cycle and using bleeding edge packages","text":"CRAN continuously getting new updated packages. use R outside Nix, running install.packages(pkg) install latest version {pkg} package available CRAN (unless changed default repository url). Nix, packages get downloaded CRAN nixpkgs repository may outdated explained . require bleeding edge packages, use \"bleeding_edge\" option r_ver. download packages official nixpkgs repository anymore, fork maintain can find . fork gets updated every 12 hours latest commits nixpkgs repository CRAN. means environments generated using fork contain bleeding packages CRAN (Bioconductor) packages well system-level dependencies. Also, aware generate expression reproducible! time rebuild environment generated using \"bleeding_edge\" option, get exactly : environment bleeding edge packages build time. want instead bleeding edge packages time generate expression, want reproducibility (words, building always result environment), use \"frozen_edge\" option instead. case, whatever option choose, using comes cost must aware. First, packages bleeding edge, chance built Hydra yet. Hydra periodically builds packages get cached. ’re using Nix, pre-compiled binaries get used instead built source. case use fork, unless also use cache provide, courtesy cachix.org. Cachix provides cache projects works seamlessly official Nix cache. However, limited space, possible cache CRAN packages. popular packages get built cached, hopefully packages need part limited set. use cache, run following commands computer. First, install Cachix client: use cache: ’s ! Packages now get pulled official cache, also dedicated rstats--nix cache. cache also contains latest version R, sometimes can also lag behind official nixpkgs repository.","code":"nix-env -iA cachix -f https://cachix.org/api/v1/install cachix use rstats-on-nix"},{"path":"https://b-rodrigues.github.io/rix/articles/z-bleeding_edge.html","id":"making-your-own-cache","dir":"Articles","previous_headings":"","what":"Making your own cache","title":"z - Advanced topic: Understanding the rPackages set release cycle and using bleeding edge packages","text":"need packages included rstats--nix cache, can easily roll binary cache. Simply build environment one machine, push binaries cache re-use. Refer vignette vignette(\"z-binary_cache\") learn set cache.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"z - Advanced topic: Contributing to nixpkgs","text":"want help us make R ecosystem better Nix fixing packages, read ! Vignette help help us! lists common ways packages can break teaches fix R packages inclusion nixpkgs. Every package available CRAN Bioconductor gets built Hydra made available rPackages package set. ’s need manually package . However, packages don’t build successfully, require manual fixing. quick, one-line fixes, others require bit work. goal Vignette make quickly familiar main reasons package may broken explain fix , certain packages get fixed certain ways. vignette assumes comfortable Git concepts branches PRs (pull requests) compiling software Linux.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"setting-up","dir":"Articles","previous_headings":"","what":"Setting up","title":"z - Advanced topic: Contributing to nixpkgs","text":"first need set thing. Fork nixpkgs repository clone computer. , add original repository remote: way, time want fix package, can fetch latest updates upstream merge local copy: Make sure merge latest commits upstream regularly, nixpkgs gets updated frequently day. can now look package fix. reason update local copy, make sure ’re master reset hard: Always make sure create new branch fix package, don’t work master, ’ll just asking trouble! might also want join Matrix chat room coordinate efforts. can join .","code":"git checkout master  # Add upstream as a remote git remote add upstream git@github.com:NixOS/nixpkgs.git # Fetch latest updates git fetch upstream  # Merge latest upstream/master to your master git merge upstream/master git reset --hard upstream/master"},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"where-to-find-packages-to-fix","dir":"Articles","previous_headings":"","what":"Where to find packages to fix","title":"z - Advanced topic: Contributing to nixpkgs","text":"first step help fix package find package fix: visit latest rPackages evaluation . Click “Still failing jobs” tab see packages’ builds didn’t succeed click package. see something like : , can see {AIUQ}’s build failed another package, {SuperGauss}, fixing {SuperGauss} likely fix one well. can look {SuperGauss} “Still failing jobs” tab, see {SuperGauss} failed, check little dashboard built can find . dashboard shows essentially information find “Still failing jobs” tab , several added niceties. First , ’s column called fails_because_of shows name package caused another fail. example {AIUQ}, {SuperGauss} listed (package fails another reason, like missing system-level dependency, name listed ). can type {SuperGauss} little box filter see packages fail . , can also see package’s package rank. rank computed using packageRank package, table sorted lowest rank (low ranks indicate high popularity ’s also percentile column indicates percentage packages higher downloads). Finally, ’s direct link PR fixing package (opened) also PR’s status: merged already ? link PR quite useful, immediately tells someone already tried fixing . PR merged, simply try another fix package. PR open yet merged, great opportunity help review ()! Let’s go back fixing {SuperGauss}. go back Hydra, can see error message thrown building: Click logfile (either pretty, raw tail) see happened. ’s see: issue system-level dependencies missing, pkg-config FFTW, need add fix build. brings us first recipe cookbook!","code":"checking for pkg-config... no checking for FFTW... configure: error: in `/build/SuperGauss': configure: error: The pkg-config script could not be found or is too old.  Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config.  Alternatively, you may set the environment variables FFTW_CFLAGS and FFTW_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.  To get pkg-config, see . See `config.log' for more details ERROR: configuration failed for package 'SuperGauss' * removing '/nix/store/jxv5p85x24xmfcnifw2ibvx9jhk9f2w4-r-SuperGauss-2.0.3/library/SuperGauss'"},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"case-1-packages-that-need-dependencies-to-build","dir":"Articles","previous_headings":"","what":"Case 1: packages that need dependencies to build","title":"z - Advanced topic: Contributing to nixpkgs","text":"Fixing packages require system-level dependencies matter adding one, maybe two lines, right place expression defines whole rPackages set. can find file . , find line starts packagesWithNativeBuildInputs = { another starts packagesWithBuildInputs = { define long list packages. difference NativeBuildInputs BuildInputs dependencies needed compilation get listed NativeBuildInputs (things like compilers packages pkg-config) dependencies needed run-time (dynamic libraries) get listed BuildInputs. R, actually, put everything NativeBuildInputs still work, try pay attention properly. case doubt, put everything NativeBuildInputs: reviewing PR, people tell put . anything else, try build package. following line drop interactive Nix shell package build succeeds (run command root cloned nixpkgs directory): see error Hydra, made sure PR opened, can start fixing package. , need add two dependencies. Let’s read relevant lines error message : look default.nix file, particular two lists define packages need nativeBuildInputs buildInputs, ’ll see many pkg-config listed already. let’s add following line packagesWithNativeBuildInputs one packagesWithBuildInputs: pkg-config needed compile {SuperGauss} fftw.dev needed run-time well. Try build shell {SuperGauss} : worked, start R load library. Sometimes packages can build successfully fail launch, taking time load avoids wasting reviewer’s time. Ideally, try run one several examples package’s vignette help files. also makes sure everything working properly. testing succeeded, can now open PR! committing, make sure seprate branch fix (can changes master long don’t commit change branch): , make sure default.nix file changed: Sometimes, running examples may produce files, ’s case get rid . files added case add default.nix commit write following commit message: commit message follows nixpkgs’s contributing guidelines. Format messages like . Now push changes: go fork’s repository open PR. Congratulations, fixed first package!","code":"nix-shell -I nixpkgs=. -p R rPackages.SuperGauss configure: error: The pkg-config script could not be found or is too old.  Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config.  Alternatively, you may set the environment variables FFTW_CFLAGS and FFTW_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. SuperGauss = [ pkgs.pkg-config ]; SuperGauss = [ pkgs.fftw.dev ]; nix-shell -I nixpkgs=. -p R rPackages.SuperGauss git checkout -b fix_supergauss git status user@computer:~/Documents/nixpkgs(fix_supergauss *)$ git status On branch fix_supergaus Changes not staged for commit:   (use \"git add ...\" to update what will be committed)   (use \"git restore ...\" to discard changes in working directory)     modified:   pkgs/development/r-modules/default.nix  no changes added to commit (use \"git add\" and/or \"git commit -a\") git add . git commit -m \"rPackages.SuperGauss: fixed build\" git push origin fix_supergauss"},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"case-2-packages-that-need-a-home-x-or-simple-patching","dir":"Articles","previous_headings":"","what":"Case 2: packages that need a home, X, or simple patching","title":"z - Advanced topic: Contributing to nixpkgs","text":"package may require /home directory installation process. usually fail message looks like : add package list named packagesRequiringHome try rebuilding. See PR example: https://github.com/NixOS/nixpkgs/pull/292336 packages require X, X11, windowing system Linux distributions. words, pacakges must installed machine graphical session running. ’s case Hydra, needs mocked. Simply add package list named packagesRequiringX try rebuilding. See PR https://github.com/NixOS/nixpkgs/pull/292347 example. Finally, packages must compiled need first configured. common step compiling software. configuration step ensures needed dependencies found (among things). Nix works way , can happen configuration step fails dependencies usual /usr/bin /bin, etc, paths. needs patched configuration step. fix , configuration file lists different dependencies found needs patched, can done overriding one phases configure phase. override postPatch phase like : Read patchShebangs . See PR example: https://github.com/NixOS/nixpkgs/pull/289775 Sometimes patching bit complicated. See example .","code":"Warning in normalizePath(\"~\") :   path[1]=\"/homeless-shelter\": No such file or directory RcppCGAL = old.RcppCGAL.overrideAttrs (attrs: {   postPatch = \"patchShebangs configure\"; });"},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"case-3-packages-that-require-their-attributes-to-be-overridden","dir":"Articles","previous_headings":"","what":"Case 3: packages that require their attributes to be overridden","title":"z - Advanced topic: Contributing to nixpkgs","text":"Staying topic overrides, can also happen packages need one attributes overridden. already much complex cases , error messages may hint attributes override can much cryptic. example, ’s build log xslt: hint url pointing gcc’s manual entry -fpermissive flag. happened code raises warning compilation: without flag, warning gets turned error. need add flag compilation “tolerate” warning. ’s done xslt: attribute override NIX_CFLAGS_COMPILE attribute. add -fpermissive flags ’re good go. Check PR complete {xlst} example:https://github.com/NixOS/nixpkgs/pull/292329 Also take time read examples overrides default.nix file learn common attributes need overridden.","code":"Running phase: unpackPhase unpacking source archive /nix/store/gxcysc8y3x1wz7qz3q1fpv8g8f92iqyv-xslt_1.4.4.tar.gz source root is xslt setting SOURCE_DATE_EPOCH to timestamp 1676995202 of file xslt/MD5 Running phase: patchPhase Running phase: updateAutotoolsGnuConfigScriptsPhase Running phase: configurePhase Running phase: buildPhase Running phase: checkPhase Running phase: installPhase * installing *source* package 'xslt' ... ** package 'xslt' successfully unpacked and MD5 sums checked ** using staged installation Found pkg-config cflags and libs! Using PKG_CFLAGS=-I/nix/store/8jkj0gm1chw8rhpqbpljydlwsm6hmgwp-libxslt-1.1.39-dev/include -I/nix/store/iqjsxkcdnvvz1bfpq960ygicc5clz9hv-libxml2-2.12.3-unstable-2023-12-14-dev/include/libxml2 Using PKG_LIBS=-L/nix/store/ksp5m4p5fi1d8zvhng96qqzy1wqc51v6-libxslt-1.1.39/lib -L/nix/store/4jvs7wz2jfmc6x9zgngfcr9804x9hwln-libxml2-2.12.3-unstable-2023-12-14/lib -lexslt -lxslt -lxml2 ** libs using C++ compiler: 'g++ (GCC) 13.2.0' rm -f RcppExports.o xslt.o xslt_init.o xslt.so /nix/store/xq8920m5mbd83vdlydwli7qsh67gfm5v-gcc-wrapper-13.2.0/bin/c++ -std=gnu++17 -I\"/nix/store/403kbh5v910gks340j7s1647kijm60rv-R-4.3.2/lib/R/include\" -DNDEBUG -I/nix/store/8jkj0gm1chw8rhpqbpljydlwsm6hmgwp-libxslt-1.1.39-dev/include -I/nix/store/iqjsxkcdnvvz1bfpq960ygicc5clz9hv-libxml2-2.12.3-unstable-2023-12-14-dev/include/libxml2 -DSTRICT_R_HEADERS -I'/nix/store/0vzi341m7nbxhdbi8kj50nwn7rrssk5z-r-Rcpp-1.0.12/library/Rcpp/include' -I'/nix/store/h6z1v3qb2pxhb3yjrykdaircz3xk1jla-r-xml2-1.3.6/library/xml2/include'     -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o /nix/store/xq8920m5mbd83vdlydwli7qsh67gfm5v-gcc-wrapper-13.2.0/bin/c++ -std=gnu++17 -I\"/nix/store/403kbh5v910gks340j7s1647kijm60rv-R-4.3.2/lib/R/include\" -DNDEBUG -I/nix/store/8jkj0gm1chw8rhpqbpljydlwsm6hmgwp-libxslt-1.1.39-dev/include -I/nix/store/iqjsxkcdnvvz1bfpq960ygicc5clz9hv-libxml2-2.12.3-unstable-2023-12-14-dev/include/libxml2 -DSTRICT_R_HEADERS -I'/nix/store/0vzi341m7nbxhdbi8kj50nwn7rrssk5z-r-Rcpp-1.0.12/library/Rcpp/include' -I'/nix/store/h6z1v3qb2pxhb3yjrykdaircz3xk1jla-r-xml2-1.3.6/library/xml2/include'     -fpic  -g -O2  -c xslt.cpp -o xslt.o /nix/store/xq8920m5mbd83vdlydwli7qsh67gfm5v-gcc-wrapper-13.2.0/bin/c++ -std=gnu++17 -I\"/nix/store/403kbh5v910gks340j7s1647kijm60rv-R-4.3.2/lib/R/include\" -DNDEBUG -I/nix/store/8jkj0gm1chw8rhpqbpljydlwsm6hmgwp-libxslt-1.1.39-dev/include -I/nix/store/iqjsxkcdnvvz1bfpq960ygicc5clz9hv-libxml2-2.12.3-unstable-2023-12-14-dev/include/libxml2 -DSTRICT_R_HEADERS -I'/nix/store/0vzi341m7nbxhdbi8kj50nwn7rrssk5z-r-Rcpp-1.0.12/library/Rcpp/include' -I'/nix/store/h6z1v3qb2pxhb3yjrykdaircz3xk1jla-r-xml2-1.3.6/library/xml2/include'     -fpic  -g -O2  -c xslt_init.cpp -o xslt_init.o xslt_init.cpp: In function 'void R_init_xslt(DllInfo*)': xslt_init.cpp:36:37: error: invalid conversion from 'void (*)(void*, xmlError*)' {aka 'void (*)(void*, _xmlError*)'} to 'xmlStructuredErrorFunc' {aka 'void (*)(void*, const _xmlError*)'} [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-fpermissive-fpermissive8;;]    36 |     xmlSetStructuredErrorFunc(NULL, handleError);       |                                     ^~~~~~~~~~~       |                                     |       |                                     void (*)(void*, xmlError*) {aka void (*)(void*, _xmlError*)} In file included from xslt_init.cpp:4: /nix/store/iqjsxkcdnvvz1bfpq960ygicc5clz9hv-libxml2-2.12.3-unstable-2023-12-14-dev/include/libxml2/libxml/xmlerror.h:898:57: note:   initializing argument 2 of 'void xmlSetStructuredErrorFunc(void*, xmlStructuredErrorFunc)'   898 |                                  xmlStructuredErrorFunc handler);       |                                  ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ make: *** [/nix/store/403kbh5v910gks340j7s1647kijm60rv-R-4.3.2/lib/R/etc/Makeconf:200: xslt_init.o] Error 1 ERROR: compilation failed for package 'xslt' * removing '/nix/store/1p4qp17ccjvi53g3vl67j3z8n1lp61m3-r-xslt-1.4.4/library/xslt' xslt = old.xslt.overrideAttrs (attrs: {   env = (attrs.env or { }) // {     NIX_CFLAGS_COMPILE = attrs.env.NIX_CFLAGS_COMPILE + \" -fpermissive\";   }; });"},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"case-4-packages-that-need-a-dependency-that-must-be-overridden","dir":"Articles","previous_headings":"","what":"Case 4: packages that need a dependency that must be overridden","title":"z - Advanced topic: Contributing to nixpkgs","text":"Sometimes attribute package needs overriden, one dependencies. example, opencv R packages requires opencv software compiled using specific configuration option enableGtk2 = true. However, version opencv available nixpkgs doesn’t flag set true. ’s issue, since can override . See PR see done. Another interesting example PR fixing hdf5r. Even though merged end, still think study , solution tried quite instructive! Finally, ’s example fixing {arrow}. included comment explains ’s happening quite well won’t rewrite .","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"case-5-darwin-specific-fixes","dir":"Articles","previous_headings":"","what":"Case 5: darwin-specific fixes","title":"z - Advanced topic: Contributing to nixpkgs","text":"Darwin (macOS) may require specific fixes packages work. won’t detail , don’t required hardware, can look pkgs/development/r-modules/default.nix file darwin-specific fixes. Look “darwin” string find several examples.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"case-6-an-r-packages-requires-software-not-in-nixpkgs-or-outdated-in-nixpkgs","dir":"Articles","previous_headings":"","what":"Case 6: an R packages requires software not in nixpkgs (or outdated in nixpkgs)","title":"z - Advanced topic: Contributing to nixpkgs","text":"R packages depend software function. instance, {RQuantlib} requires quantlib outdated nixpkgs leading build failure. PR, ’ll see first quantlib got updated, {RQuantlib} fixed. Another example: Rsymphony required Symphony optimizer available, completely missing nixpkgs. example, ’ll see Symphony added nixpkgs {RSymphony} fixed","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"study-study-study-study","dir":"Articles","previous_headings":"","what":"Study! Study! Study! Study!","title":"z - Advanced topic: Contributing to nixpkgs","text":"best way learn, read already done others. guide can hopefully get started quickly, highly recommend check PRs opened merged . stated already, don’t hesitate join Matrix channel need help get started!","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"broken-packages","dir":"Articles","previous_headings":"","what":"Broken packages","title":"z - Advanced topic: Contributing to nixpkgs","text":"Finally, packages “broken”. packages absolutely require something function Nix easily provide: instance, packages must connect internet download stuff installation time. building Nix happens sandbox ensure purity, packages work, unless way circumvent need connection. example, PR see possible download content required build time beforehand, installation can still succeed. packages require example linked proprietary software, Rcplex. also possible fix package, little incentive require get evaluation version software fix package. However, build still listed failing Hydra, get proprietary software (even evaluation version) installed . Also, require quite effort keep maintaining. suggest packages “broken”, add brokenPackages list pkgs/development/r-modules/default.nix.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"reviewing-prs","dir":"Articles","previous_headings":"","what":"Reviewing PRs","title":"z - Advanced topic: Contributing to nixpkgs","text":"accelerate merging PRs, always helps people review first! want help reviewing, can proceed follows. First, highly recommend use following script put together Kupac: Save file called rpkg-pr-review (whatever prefer) $PATH (example, home//bin/, make sure folder $PATH) make executable: Find PR need review. Find commit ID PR: can now use script saved : Replace COMMIT_ID Git commit ID PR, pkg1 pkg2 package(s) need review. download everything needed drop interactive radian shell can test packages (prefer standard R shell, replace radianWrapper rWrapper, radian pretty neat, give go!) can test package works, try examples . can also check fix : understand fix works? done differently? can make suggestions committer . , can also approve PR Github’s interface:","code":"#!/usr/bin/env bash  nix-shell -p \"radianWrapper.override{packages = with rPackages; [ ${*:2} ];}\" \\           -I nixpkgs=\"https://github.com/nixos/nixpkgs/archive/$1.tar.gz\" --run radian chmod +x rpkg-pr-review rpkg-pr-review COMMIT_ID pkg1 pkg2"},{"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.9.1, 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.9.1},   url = {https://b-rodrigues.github.io/rix/}, }"},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"rix-reproducible-environments-with-nix-","dir":"","previous_headings":"","what":"Rix: Reproducible Environments with Nix","title":"Rix: Reproducible Environments with Nix","text":"Introduction Quick start returning users Docker Docker renv Ana/Miniconda Mamba Nix different Guix? rix ? Contributing Thanks Recommended reading","code":""},{"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). project-specific environment also include required system-level dependencies can difficult install, GDAL packages geospatial analysis example. Nix installs software complete “bundle” include software’s dependencies, dependencies’ dependencies . Nix incredibly useful piece software ensuring reproducibility projects, research otherwise. use cases include, example, running web applications like Shiny apps plumber APIs controlled environment, executing targets pipelines right version R dependencies, use environments managed Nix work interactively using IDE. essence, means can use rix Nix replace renv Docker one single tool, approach quite different: renv records specific versions individual packages, rix provides complete snapshot R ecosystem specific point time, also snapshots required dependencies make project-specific R environment work. contrast, ensure complete reproducibility renv, must combined Docker, order include system-level dependencies (like GDAL, per example ). Nix fairly steep learning curve though. Nix complex piece software comes programming language, also called Nix. purpose solve complex problem: defining instructions build software packages manage configurations declarative way, using functional programming principles. makes sure software gets installed fully reproducible manner, operating system hardware, caveat users must learn Nix programming language get “functional programming approach software management” mindset, unusual. rix provides functions help write 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 includes currently 100.000 pieces software available Nix package manager. rix, can define development environments, shells, contain required tools needed analyze data using R. environments isolated project-specific: means project can use one version R R packages, another environment another version R R packages. However, extra care required already R installed usual method operating system, development environments totally isolated rest system. Unlike Docker, running container acces anything host system, unless explicitely configured , Nix development shells nothing environments add software list already available software (-called PATH). , possible access anything (files software) already present system running Nix shell. Thus, rix also provides function called rix_init() helps isolate R sessions running inside Nix environments rest system. avoids clashes Nix-specific library R packages user library R packages already R installed managed usual method operating system. also possible add software package available Nixpkgs Nix environment, example IDEs RStudio VS Code. Nix R ecosystem currently includes almost entirety CRAN Bioconductor packages (around hundred CRAN Biocondcuctor packages unavailable Nix). Like programming language software, also possible install older releases R packages, install packages GitHub defined states, well local packages .tar.gz format. 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. need tools languages like Python Julia, can also done easily. Nix available Linux, macOS Windows (via WSL2) rix comes following features: define complete development environments code use anywhere; install project-specific complete R environments, can different ; 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: Now try build expression using rix(): generates file called default.nix path path_default_nix correct expression build environment. build environment, Nix package manager must installed. Nix installed, can build expression using nix-build terminal command enter environment using nix-shell. vignettes included package walk whole workflow.","code":"install.packages(\"rix\", repos = c(   \"https://b-rodrigues.r-universe.dev\",   \"https://cloud.r-project.org\" ))  library(\"rix\") library(rix)  path_default_nix <- \".\"  rix(   r_ver = \"4.3.3\",   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. know , read vignette(\"z-advanced-topic-using-nix-inside-docker\") link.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"docker-and-renv","dir":"","previous_headings":"How is Nix different from Docker+renv/{groundhog}/{rang}/(Ana/Mini)Conda/Guix? or Why Nix?","what":"Docker and renv","title":"Rix: Reproducible Environments with Nix","text":"Let’s start arguably popular combo reproducibility R ecosystem, Docker+renv (also possible add rspm bspm combination renv install required system-level dependencies automatically). {renv} snapshots state library R packages project, nothing , nothing less. can used restore library packages another machine, user’s responsibility ensure right version R system-level dependencies available machine. whay renv often coupled versioned Docker image, images Rocker project. Combining provides robust way serve applications Shiny apps, can awkward develop interactively setup, time, people work current setup, dockerize setup ’re done. However, need make sure keep updating image, underlying operating system eventually reach end life. Eventually, might even update whole stack become impossible install version R R packages used recent Docker image. can good thing actually; opportunity update app make sure benefits latest security patches. However reproducibility research, something impact historical results. suggest instead, keep using Docker already invested ecosystem, continue use deploy serve applications archive research. instead using renv get right packages, combine Docker Nix. way, nice separation concerns: Docker used platter serve code, environment handled Nix. even use image gets continuously updated ubuntu:latest base: doesn’t matter image always changing, since environment heavy lifting inside container completely reproducible thanks Nix. Exactly reasoning can applied groundhog, rang CRAN snapshots Posit combination Docker instead renv.","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"anamini-conda-and-mamba","dir":"","previous_headings":"How is Nix different from Docker+renv/{groundhog}/{rang}/(Ana/Mini)Conda/Guix? or Why Nix?","what":"Ana/Mini-conda and Mamba","title":"Rix: Reproducible Environments with Nix","text":"Anaconda, Miniconda, Mamba, Micromamba… (henceforth ’ll refer Conda) Nix much common: multiplatform package managers can used setup reproducible development environments many languages, R Python. Using conda-lock one can generate fully reproducible lock files can used Conda build environment defined lock file. main difference Conda Nix conceptual might seem important end-users: Conda procedural package manager, Nix functional package manager. practice means environments managed Conda mutable users prevented changing environment interactively, re-generate lock file. quite comfortable working interactively, can lead issues dependency management might get borked. case Nix however, environments immutable: add software running Nix environment. need stop working, re-define environment, rebuild use . might sound tedious () forces users work “cleanly” avoids many issues dynamically changing environment. possible build environment, fails early possible forces deal issue. mutating environment lead false sense safeness. Another major difference Conda include entirety CRAN Bioconductor, case Nix. According Anaconda’s Documentation 6000 CRAN packages available Conda (writing July 2024, CRAN 21’000+ packages). Nix also includes almost Bioconductor packages, Conda includes trough Bioconda project, however, able find Bioconda contains Bioconductor. According Bioconda’s FAQ, Bioconductor data packages included.","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"how-is-nix-different-from-guix","dir":"","previous_headings":"How is Nix different from Docker+renv/{groundhog}/{rang}/(Ana/Mini)Conda/Guix? or Why Nix?","what":"How is Nix different from Guix?","title":"Rix: Reproducible Environments with Nix","text":"Just like Nix, Guix functional package manager focus reproducible builds. won’t go technical differences/similarities, pratical ones end-users R programming language. want know technical aspects, read https://news.ycombinator.com/item?id=18910683. main shortcoming Guix R users CRAN Bioconductor packages included, Guix available Windows macOS.","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"is-rix-all-there-is","dir":"","previous_headings":"How is Nix different from Docker+renv/{groundhog}/{rang}/(Ana/Mini)Conda/Guix? or Why Nix?","what":"Is {rix} all there is?","title":"Rix: Reproducible Environments with Nix","text":", tools might want check , especially want set polyglot environments (even though possible use rix set environment R Python packages example). Take look https://devenv.sh/ https://prefix.dev/ want explore tools make using Nix easier!","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"contributing","dir":"","previous_headings":"","what":"Contributing","title":"Rix: Reproducible Environments with Nix","text":"Refer Contributing.md learn contribute package.","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). Finally, thanks David Solito creating rix’s logo!","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":"Nix revisions old R releases","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()  available_r"},{"path":"https://b-rodrigues.github.io/rix/reference/available_r.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"List available R versions from Nixpkgs — available_r","text":"data frame 39 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/available_r.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"List available R versions from Nixpkgs — available_r","text":"Nix Package Version, Marcelo Lazaroni","code":""},{"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\"  \"4.3.2\"  \"4.3.3\"  \"4.4.0\""},{"path":"https://b-rodrigues.github.io/rix/reference/ga_cachix.html","id":null,"dir":"Reference","previous_headings":"","what":"ga_cachix Build an environment on Github Actions and cache it on Cachix — ga_cachix","title":"ga_cachix Build an environment on Github Actions and cache it on Cachix — ga_cachix","text":"ga_cachix Build environment Github Actions cache Cachix","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/ga_cachix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ga_cachix Build an environment on Github Actions and cache it on Cachix — ga_cachix","text":"","code":"ga_cachix(cache_name, path_default)"},{"path":"https://b-rodrigues.github.io/rix/reference/ga_cachix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"ga_cachix Build an environment on Github Actions and cache it on Cachix — ga_cachix","text":"cache_name String, name cache. path_default String, relative path (root directory project) default.nix build.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/ga_cachix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"ga_cachix Build an environment on Github Actions and cache it on Cachix — ga_cachix","text":"Nothing, copies file directory.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/ga_cachix.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"ga_cachix Build an environment on Github Actions and cache it on Cachix — ga_cachix","text":"function puts .yaml file inside .github/workflows/ folders root project. workflow file use projects default.nix file generate development environment Github Actions cache created binaries Cachix. Create free account Cachix use action. Refer vignette(\"z-binary_cache\") detailed instructions. Make sure give read write permissions Github Actions bot.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/ga_cachix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"ga_cachix Build an environment on Github Actions and cache it on Cachix — ga_cachix","text":"","code":"if (FALSE) { # \\dontrun{ ga_cachix(\"my-cachix\", path_default = \"default.nix\") } # }"},{"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 = \".\", message_type = c(\"simple\", \"quiet\", \"verbose\"))"},{"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. message_type Character vector messaging type, Either \"simple\" (default), \"quiet\" messaging, \"verbose\".","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) { # \\dontrun{ nix_build() } # }"},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate a Nix expression that builds a reproducible development environment — rix","title":"Generate a Nix expression that builds a reproducible development environment — rix","text":"Generate 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":"Generate 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,   local_r_pkgs = NULL,   tex_pkgs = NULL,   ide = c(\"other\", \"code\", \"radian\", \"rstudio\", \"rserver\"),   project_path = \".\",   overwrite = FALSE,   print = FALSE,   message_type = \"simple\",   shell_hook = NULL )"},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate 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. older versions R, nix-build might fail error stating 'derivation meant built'. case, simply drop shell nix-shell instead building first. also possible provide either \"bleeding_edge\" \"frozen_edge\" need environment bleeding edge packages. Read \"Details\" section . 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. local_r_pkgs List. list local packages install. packages need .tar.gz .zip formats must folder generated \"default.nix\" file. 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\" \"rserver\" server version. Use \"code\" Visual Studio Code. can also use \"radian\", interactive REPL. 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\". folder exist, created. overwrite Logical, defaults FALSE. TRUE, overwrite default.nix file specified path. print Logical, defaults FALSE. TRUE, print default.nix console. message_type Character. Message type, defaults \"simple\", gives minimal sufficient feedback. values currently \"quiet, generates files without message, \"verbose\", displays messages. shell_hook Character length 1, defaults NULL. Commands added shellHook variable executed Nix shell starts. default, using nix-shell default.nix start specific program, possibly flags (separated space), /shell actions. can example use shell_hook = R, want directly enter declared Nix R session dropping Nix shell.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate a Nix expression that builds a reproducible development environment — rix","text":"Nothing, function side-effect writing two files: default.nix .Rprofile working directory. default.nix contains Nix expression build reproducible environment using Nix package manager, .Rprofile ensures running R session Nix environment access local libraries, install packages using install.packages().","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Generate a Nix expression that builds a reproducible development environment — rix","text":"function write default.nix .Rprofile 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. possible use environments built Nix interactively, either terminal, using interface RStudio. want use RStudio, set ide argument \"rstudio\". Please aware RStudio available macOS Nix. , may want use another editor macOS. use Visual Studio Code (Codium), set ide argument \"code\", add {languageserver} R package list R packages installed Nix environment. can use version Visual Studio Code Codium already use, also install using Nix (adding \"vscode\" \"vscodium\" list system_pkgs). non-interactive use, use environment command line, another editor (Emacs Vim), set ide argument \"\". recommend reading vignette(\"e-interactive-use\") details. Packages install Github must provided list 4 elements: \"package_name\", \"repo_url\" \"commit\". argument can also list lists 3 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. Note installing packages Git old versions using \"@\" notation local packages, leverage Nix's capabilities dependency solving. , might trouble installing packages. case, open issue {rix}'s Github repository. 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. possible use \"bleeding_edge\" \"frozen_edge\" value r_ver argument. create environment latest R packages. \"bleeding_edge\" means every time build environment, packages get updated. especially useful environments need constantly updated, example developing package. contrast, \"frozen_edge\" create environment remain stable build time. create default.nix file using \"bleeding_edge\", time build using nix-build environment --date. \"frozen_edge\" environment --date date default.nix generated, subsequent call nix-build result environment. highly recommend read vignette titled \"z - Advanced topic: Understanding rPackages set release cycle using bleeding edge packages\".","code":""},{"path":[]},{"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 setup via Nix. — rix_init","title":"Initiate and maintain an isolated, project-specific, and runtime-pure R setup 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 setup via Nix. — rix_init","text":"","code":"rix_init(   project_path = \".\",   rprofile_action = c(\"create_missing\", \"create_backup\", \"overwrite\", \"append\"),   message_type = c(\"simple\", \"quiet\", \"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 setup 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) - action set using rix() - ; \"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 \"quiet, writes .Rprofile without message, \"verbose\", displays mechanisms implemented achieve fully controlled R project environments Nix.","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 setup 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 setup via Nix. — rix_init","text":"Enhancement computational reproducibility Nix-R environments: primary goal rix::rix_init() enhance computational reproducibility Nix-R environments runtime. Concretely, already system user library R packages (R installed usual means operating system), using rix::rix_init() prevent Nix-R environments load packages user library cause issues. 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(). rix::rix_init() called automatically rix::rix() generating default.nix file, called rix::rix() add .Rprofile none exists. case custom .Rprofile wish keep using, also want benefit rix_init() offers, manually call set rprofile_action \"append\".","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 setup via Nix. — rix_init","text":"","code":"if (FALSE) { # \\dontrun{ # create an isolated, runtime-pure R setup via Nix project_path <- \"./sub_shell\" if (!dir.exists(project_path)) dir.create(project_path) rix_init(   project_path = project_path,   rprofile_action = \"create_missing\",   message_type = c(\"simple\") ) } # }"},{"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 directory.","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) { # \\dontrun{ 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\"),   project_path = \".\",   message_type = c(\"simple\", \"quiet\", \"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. 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. message_type String detailed output . Currently, either \"simple\" (default), \"quiet \"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. rix_init() run automatically 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) { # \\dontrun{ # 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\", 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 = function() get_sample(seed = 1234, n = 5),   program = \"R\",   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":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-091-2024-07-30","dir":"Changelog","previous_headings":"","what":"rix 0.9.1 (2024-07-30)","title":"rix 0.9.1 (2024-07-30)","text":"Fix directory creation with_nix(), using recursive = TRUE dir.create()","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"user-facing-changes-0-9-0","dir":"Changelog","previous_headings":"","what":"User-facing changes","title":"rix 0.9.0 (2024-07-22)","text":"rix::rix(): necessary anymore provide branch_name list element R packages GitHub git_pkgs.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-9-0","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.9.0 (2024-07-22)","text":"error ide = \"rstudio\" additional R packages chosen. situation, rStudioWrapper approach work resulting Nix expression build. returned error states either add rstudio system_pkgs, add R packages r_pkgs git_pkgs.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"chores-0-9-0","dir":"Changelog","previous_headings":"","what":"Chores","title":"rix 0.9.0 (2024-07-22)","text":"Github Actions: now use rhub2 checking package rix::rix() docs: explain options(rix.sri_hash). Source code now follows tidyverse style guide thanks styler Readme: added section explain comparing {rix} Nix package managers","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"new-features-0-8-0","dir":"Changelog","previous_headings":"","what":"New features","title":"rix 0.8.0 (2024-07-02)","text":"Added possibility install local archives via local_r_pkgs argument. Compute hash git CRAN archive packages locally nix installed. also new options(rix.sri_hash=\"API_server\"), online hashing via http://git2nixsha.dev can requested even Nix installed locally.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"user-facing-changes-0-8-0","dir":"Changelog","previous_headings":"","what":"User-facing changes","title":"rix 0.8.0 (2024-07-02)","text":"Now runs rix_init() ensure runtime purity via .Rprofile. exclude system’s user library .libPaths(), search path contain path per package Nix store. New message_type option control signalling done. nix_build(), with_nix(): stabilize API; get rid exec_mode core functions. cases, “non-blocking” system calls run system commands like nix-shell nix-build. rix_init(), nix_build(), with_nix(): gain message_type = \"quiet\", suppresses messages. , messaging standardized via internal helpers called.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"chores-0-8-0","dir":"Changelog","previous_headings":"","what":"Chores","title":"rix 0.8.0 (2024-07-02)","text":"Fine-tune formatting *.nix files generated low-level requests {curl} -> remove {httr} dependency ROpenSci review: complete documentation internal functions remove nix_file interface with_nix() document","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-071-2024-05-24","dir":"Changelog","previous_headings":"","what":"rix 0.7.1 (2024-05-24)","title":"rix 0.7.1 (2024-05-24)","text":"Better messages comments top generated default.nix files.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-070-2024-05-21","dir":"Changelog","previous_headings":"","what":"rix 0.7.0 (2024-05-21)","title":"rix 0.7.0 (2024-05-21)","text":"Added possibility create “bleeding_edge” “frozen_edge” environments Added possibility use radian environment’s console (courtesy kupac) RStudio server Added ga_cachix(), function create GA workflow file builds pushes environment Cachix cache","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-0609000-2024-05-05","dir":"Changelog","previous_headings":"","what":"rix 0.6.0.9000 (2024-05-05)","title":"rix 0.6.0.9000 (2024-05-05)","text":"with_nix(): use --vanilla respect custom code startup via .Rprofile nix_build() with_nix(): improvements. Remove nix-build artefact file using Sys.() checking availability. with_nix(): clean itermediary output artefacts (files) exit Patch rix() shell_hook = NULL default, Nix-R wrappers nix_build() with_nix(); update testfiles with_nix(): try sessionInfo(); fails R Nixpkgs darwin remove R_LIBS_USER .libPaths() covr test environment nix_build() & with_nix(): fix segmentation fault adjusting LD_LIBRARY_PATH temporarily nix_build(): consistently separate cmd args nix-build system command nix_build(): another guardrail run-time purity Nixpkgs R implement nix_file specify specific .nix file Make nix_shell() with_nix() compatible RStudio macOS, R session (yet) started shell. Now /nix/var/nix/profiles/default/bin added PATH variable nix_shell() with_nix() called RStudio version system (Nix package). Add rix::init() initiate maintain isolated, project-specific pure R setup via Nix update glibcLocales patch -with_nix() needs patch R <= 4.2.0; glibcLocalesUtf8 -> gibcLocales Implement with_nix() valuate function R shell command via nix-shell environment 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":"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":[]},{"path":"https://b-rodrigues.github.io/rix/CONTRIBUTING.html","id":"development-environment","dir":"","previous_headings":"","what":"Development environment","title":"Contributing","text":"provide default.nix file defines right development environment already Nix user wish contribute package. development environment provide bleeding edge packages, uses fork nixpkgs gets updated daily (R packages included). environment bleeding edge, pre-built binaries available chache.nixos.org, building environment locally quite time-consuming. speed-process, also provide cache environment also gets updated several times day. use cache, need cachix installed configured. wish use development environment associated cache quickly right environment contribute package, run following steps: First, install cachix: nix-env -iA cachix -f https://cachix.org/api/v1/install Enable cache: cachix use rstats--nix might get error message stating user use caches. Simply follow instructions warning give right permissions user use caches. , run nix-build, binaries pulled rstats--nix.cachix.org cache.nixos.org. Building development environment nothing waiting packages download. also possibility successfully build development environment: nixpkgs fork gets updated fully automatically several times day without checks, building package fails, fix released yet. build development environment, please open issue, propose fix upstream.","code":""},{"path":"https://b-rodrigues.github.io/rix/CONTRIBUTING.html","id":"fledge","dir":"","previous_headings":"","what":"{fledge}","title":"Contributing","text":"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/rix/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":"non-technical-intro-to-nix","dir":"Articles","previous_headings":"","what":"Non-technical intro to Nix","title":"a - Getting started","text":"familiar concept package managers, can skip next section. ensure project reproducible need deal least four things: Make sure required/correct version R (language) installed; Make sure required versions packages installed; Make sure system dependencies installed (example, ’d need working Java installation install rJava R package Linux); Make sure can install hardware hand. three first bullet points, consensus seems mixture Docker deal system dependencies, renv packages (groundhog, fixed CRAN snapshot like Posit provides) R installation manager install correct version R (unless use Docker image base already ships required version default). last point, way able compile software target architecture. ’s lot moving pieces, knowledge need get right. turns solution. Docker + renv (way deal packages) likely popular way ensure reproducibility projects, tools achieve . One tool called Nix. Nix package manager Linux distributions, macOS even works Windows enable WSL2. ’s package manager? ’re Linux user, may aware. Let explain way: R, want install package provide functionality included vanilla installation R, ’d run : turns Linux distributions, like Ubuntu example, work similar way, software ’d usually install using installer (least Windows). example install Firefox Ubuntu using: (’s also graphical interfaces make process “user-friendly”). Linux jargon, packages simply call software (guess ’s “apps” days). packages get downloaded -called repositories (think CRAN, repository R packages) type software might need make computer work: web browsers, office suites, multimedia software . Nix just another package manager can use install software. interests us using Nix install Firefox, instead install R R packages require analysis (programming language need). use Nix instead usual ways install software operating systems? first thing know Nix’s repository, nixpkgs, huge. Humongously huge. ’m writing lines, ’s 100’000 pieces software available, entirety CRAN also available nixpkgs. instead installing R usually use install.packages() install packages, use Nix handle everything. still, use Nix ? Nix interesting feature: using Nix, possible install software (relatively) isolated environments. using Nix, can install many versions R R packages need. Suppose start working new project. start project, Nix, install project-specific version R R packages use particular project. switch projects, ’d switch versions R R packages. familiar renv, see exactly thing: difference project-specific library R packages, also project-specific R version. start project now, ’d R version 4.2.3 installed (latest version available nixpkgs latest version available, later), accompagnying versions R packages, long project lives (can long time). start project next year, project R, maybe R version 4.4.2 something like , set required R packages current time. Nix always installs software need separate, (isolated) environments computer. can define environment one specific project. Nix goes even : can install R R packages using Nix (isolated) project-specific environments, Nix even installs required system dependencies. example need rJava, Nix make sure install correct version Java well, always project-specific environment (already Java version installed system, won’t interference). ’s also pretty awesome, can use specific version nixpkgs always get exactly versions software whenever build environment run project’s code. environment gets defined simple plain-text file, anyone using file build environment get exactly, byte byte, environment initially started project. also regardless operating system used.","code":"install.packages(\"dplyr\") sudo apt-get install firefox"},{"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 100.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. example, already R installed, user library R packages, caution required properly use environments managed Nix. important stage understand call install.packages() running Nix environment. want add packages Nix environment analyzing data, need add default.nix expression rebuild environment. explained greater detail vignette(\"d1-installing-r-packages---nix-environment\"). avoid interference main R library packages Nix environments, calling rix() also run rix_init(), create custom .Rprofile project’s directory. .Rprofile ensure user library packages, won’t get loaded R version running Nix shell. also redefine install.packages() throw error try use . 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 local packages .tar.gz format install; 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 install packages dedicated folder computer, called Nix store. Nix done building environment, can start working interactively using following command terminal emulator (R console): drop Nix shell provides installed software. mandatory call nix-build first: can immediately call nix-shell. advantage using nix-build first create file called result prevent environment get garbage collected clean Nix store. want build environment older version R, might get warning telling build expression, can directly drop . want completely isolate Nix environment rest system, recommend using nix-shell --pure drop environment, described documentation rix_init(). Finally, want delete environment, delete result file first (used nix-build) call nix-store --gc, delete orphaned packages. 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 . can’t install Nix system, R already installed, can skip last section vignette simply install rix package.","code":""},{"path":[]},{"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":"Installing Nix","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: open /etc/wsl.conf nano, command line text editor. Add following line: Save file CTRL-O quit nano CTRL-X. , type following line powershell: relaunch WSL (Ubuntu) start menu. 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 [boot] systemd=true wsl --shutdown"},{"path":"https://b-rodrigues.github.io/rix/articles/b1-setting-up-and-using-rix-on-linux-and-windows.html","id":"the-determinate-systems-installer","dir":"Articles","previous_headings":"Installing Nix","what":"The Determinate Systems installer","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":"case-1-you-dont-have-r-installed-and-wish-to-install-it-using-nix-as-well","dir":"Articles","previous_headings":"","what":"Case 1: you don’t have R installed and wish to install it using Nix as well","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. Beware already default.nix file working directory, running rix() overwrite = TRUE argument overwrite ! make sure using version control system projects avoid bad surprises. details managing project-specific default.nix detailled vignette vignette(\"d1-installing-r-packages---nix-environment\") vignette(\"d2-installing-system-tools--texlive-packages---nix-environment\"). also include rix project-specific environments, generating default.nix like : Change commit recent one adapt project_path argument needed.","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 ) rix(   r_ver = \"latest\",   r_pkgs = NULL,   git_pkgs = list(     package_name = \"rix\",     repo_url = \"https://github.com/b-rodrigues/rix\",     commit = \"76d1bdd03d78589d399b4b9d473ecde616920a82\"   ),   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":"case-2-you-have-r-installed-through-your-oss-package-manager","dir":"Articles","previous_headings":"","what":"Case 2: you have R installed through your OS’s package manager","title":"b1 - Setting up and using rix on Linux and Windows","text":"installed R system usual means installation (Nix, decribed ), can install rix package usual well. 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, running rix() also runs rix_init() creates custom .Rprofile project’s path. custom .Rprofile ensure packages declaratively defined default.nix built part Nix store (one R package one separate derivation listed unique Nix path) appear R library path.","code":""},{"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 Nix 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.7.1 on 2024-07-01 #> # with following call: #> # >rix(r_ver = \"12a9c0004bc987afb1ff511ebb97b67497a68e22\", #> #  > 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 12a9c0004bc987afb1ff511ebb97b67497a68e22 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/12a9c0004bc987afb1ff511ebb97b67497a68e22.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 ) #>  #> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #>  #> ==> Existing isolated nix-R project folder: #>  /tmp/RtmpPmK8dU  #>  #> * current R session running outside Nix environment and not from RStudio #>  #> ==> Added `.Rprofile` file and code lines for new R sessions launched from: #> /tmp/RtmpPmK8dU #>  #> * 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 #>  #> ==> Also adjusting `PATH` via `Sys.setenv()`, so that system commands can invoke key Nix commands like `nix-build` in this RStudio session outside Nix #>  #>  #> ### Successfully generated `default.nix` and `.Rprofile` ### #> # This file was generated by the {rix} R package v0.7.1 on 2024-07-01 #> # with following call: #> # >rix(r_ver = \"79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a\", #> #  > r_pkgs = c(\"dplyr\", #> #  > \"janitor\"), #> #  > 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)  #>       quarto #>       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   ]; #>    #> }"},{"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. context R programming language, means user system library packages (meaning, library packages generated regular installation R), packages may loaded R version running Nix shell. avoid issues , calling rix() automatically runs rix_init() well, generates custom .Rprofile file project’s directory. way, regular user library packages interfere R environments managed Nix. Moreover, custom .Rprofile also redefines install.packages() makes throw error: indeed, wish add packages R environment managed Nix, add packages default.nix file instead, rebuild environment. want even make programs inaccessible running Nix environment, can drop using nix-shell --pure instead nix-shell.","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":"a-word-of-caution","dir":"Articles","previous_headings":"","what":"A word of caution","title":"d1 - Installing R packages in a Nix environment","text":"important stage understand call install.packages() running Nix environment. want add packages analyzing data, need add default.nix expression rebuild environment. goes installing packages Github; use method described vignette instead using something like remotes::install_github(). recommend create script called create_env.R similar, add call rix() : , add packages need r_pkgs run script . , build environment using nix-build , drop using nix-shell. Calling install.packages() bad idea several reasons: goes idea defining environment declarative way. able add packages using install.packages(), environment end state default.nix definition environment actual environment don’t match anymore. using install.packages() likely simply work, , cause issues. example, call install.packages(\"ggplot2\") one Nix shell, install ggplot2 “inside” Nix shell, install user’s system library packages. Nix shell changed run-time, , R instead install packages user’s library. version ggplot2, system-wide library packages, available Nix shell. call install.packages(\"ggplot2\") another Nix shell, say 6 months later, replace first version ggplot2 latest version. Ideally, manage R versions R packages using Nix, uninstall system-managed version R R packages. wish keep system-managed version R R packages, highly recommend call rix_init() Nix shells. ensure Nix projects system library packages don’t interfere .","code":"library(rix)  rix(r_ver = \"4.4.0\",     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/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.7.1 on 2024-07-01 #> # 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; however branch name required, commit enough pin exact version code needed. fusen package also installed, commit d617172447d.","code":"path_default_nix <- tempdir()  rix(   r_ver = \"4.2.1\",   r_pkgs = c(\"dplyr\", \"janitor\"),   git_pkgs = list(     list(       package_name = \"housing\",       repo_url = \"https://github.com/rap4all/housing/\",       commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"     ),     list(       package_name = \"fusen\",       repo_url = \"https://github.com/ThinkR-open/fusen\",       commit = \"d617172447d2947efb20ad6a4463742b8a5d79dc\"     )   ),   ide = \"other\",   project_path = path_default_nix,   overwrite = TRUE )"},{"path":"https://b-rodrigues.github.io/rix/articles/d1-installing-r-packages-in-a-nix-environment.html","id":"installing-local-archives","dir":"Articles","previous_headings":"","what":"Installing local archives","title":"d1 - Installing R packages in a Nix environment","text":"also possible install packages local tar.gz file. , place package folder default.nix generated, write something like : assumes chronicler_0.2.1.tar.gz knitr_1.43.tar.gz downloaded beforehand. want include local package developing, make sure first build using devtools::build() build .tar.gz archive, can, consider uploading source code package Github installing Github instead.","code":"rix(   r_ver = \"4.3.1\",   local_r_pkgs = c(\"chronicler_0.2.1.tar.gz\", \"knitr_1.43.tar.gz\"),   overwrite = TRUE )"},{"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":"path_default_nix <- tempdir()  rix(   r_ver = \"4.2.1\",   r_pkgs = c(\"dplyr\", \"janitor\", \"AER@1.2-8\"),   git_pkgs = list(     list(       package_name = \"housing\",       repo_url = \"https://github.com/rap4all/housing/\",       commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"     ),     list(       package_name = \"fusen\",       repo_url = \"https://github.com/ThinkR-open/fusen\",       commit = \"d617172447d2947efb20ad6a4463742b8a5d79dc\"     )   ),   ide = \"other\",   project_path = path_default_nix,   overwrite = TRUE ) #> # This file was generated by the {rix} R package v0.7.1 on 2024-07-01 #> # with following call: #> # >rix(r_ver = \"79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a\", #> #  > r_pkgs = c(\"dplyr\", #> #  > \"janitor\", #> #  > \"AER@1.2-8\"), #> #  > git_pkgs = list(list(package_name = \"housing\", #> #  > repo_url = \"https://github.com/rap4all/housing/\", #> #  > commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"), #> #  > list(package_name = \"fusen\", #> #  > repo_url = \"https://github.com/ThinkR-open/fusen\", #> #  > commit = \"d617172447d2947efb20ad6a4463742b8a5d79dc\")), #> #  > ide = \"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/\"; #>         rev = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"; #>         sha256 = \"sha256-s4KGtfKQ7hL0sfDhGb4BpBpspfefBN6hf+XlslqyEn4=\"; #>       }; #>       propagatedBuildInputs = builtins.attrValues { #>         inherit (pkgs.rPackages)  #>           dplyr #>           ggplot2 #>           janitor #>           purrr #>           readxl #>           rlang #>           rvest #>           stringr #>           tidyr; #>       }; #>     }) #>  #>  #>     (pkgs.rPackages.buildRPackage { #>       name = \"fusen\"; #>       src = pkgs.fetchgit { #>         url = \"https://github.com/ThinkR-open/fusen\"; #>         rev = \"d617172447d2947efb20ad6a4463742b8a5d79dc\"; #>         sha256 = \"sha256-TOHA1ymLUSgZMYIA1a2yvuv0799svaDOl3zOhNRxcmw=\"; #>       }; #>       propagatedBuildInputs = builtins.attrValues { #>         inherit (pkgs.rPackages)  #>           attachment #>           cli #>           desc #>           devtools #>           glue #>           here #>           magrittr #>           parsermd #>           roxygen2 #>           stringi #>           tibble #>           tidyr #>           usethis #>           yaml; #>       }; #>     }) #>   #>     (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":"100’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 )"},{"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.7.1 on 2024-07-01 #> # with following call: #> # >rix(r_ver = \"12a9c0004bc987afb1ff511ebb97b67497a68e22\", #> #  > 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 12a9c0004bc987afb1ff511ebb97b67497a68e22 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/12a9c0004bc987afb1ff511ebb97b67497a68e22.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) #>       quarto #>       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 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: also R installed usual method operating system, also system user library packages. library packages interfere library packages R environments managed Nix. avoid , running rix() writes default.nix file project’s path, also custom .Rprofile file well calling rix_init(). .Rprofile prevent clashes user library packages Nix environments’ library packages. Navigate folder using terminal, run nix-build build environment, nix-shell. dropped Nix shell. can also use nix-shell --pure instead, want increase isolation Nix-R environments. difference environment started nix-shell, still able access programs system, nix-shell --pure, programs installed Nix-R environment available. Try something like wget shell started nix-shell shell started nix-shell --pure example (replace wget tool installed computer). 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. , need use rix_init() won’t clash user library R packages (since don’t ), R environments managed Nix.","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 ) 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 ) 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 )"},{"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/\";        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/\";       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/\",     commit = \"eba63db477dd2f20153b75e2949eb333a36cccfc\"   ),   ide = \"other\",   project_path = path_default_nix,   overwrite = TRUE,   print = TRUE ) 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 path_default_nix <- tempdir()  rix(   r_ver = \"latest\",   r_pkgs = NULL,   system_pkgs = NULL,   git_pkgs = list(     package_name = \"highlite\",     repo_url = \"https://github.com/jimhester/highlite/\",     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/\";     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/\";       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/\";       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/\",     commit = \"1c860959310b80e67c41f7bbdc3e84cef00df18e\"   ),   ide = \"other\",   project_path = path_default_nix,   overwrite = TRUE ) #> # This file was generated by the {rix} R package v0.9.1 on 2024-08-08 #> # 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/\", #> #  > 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/\"; #>         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()'\" 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/\",     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, write default.nix file containing Nix expressions pin R version 4.1.3 Nixpkgs. following expression written default.nix subfolder ./_env_1_R-4-1-3/. also includes custom .Rprofile file ensure subshell load packages installed user’s library packages.","code":"library(\"rix\")  path_env_1 <- file.path(\".\", \"_env_1_R-4-1-3\")  rix(   r_ver = \"4.1.3\",   overwrite = TRUE,   project_path = path_env_1 ) #>  #> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #>  #> ==> Existing isolated nix-R project folder: #>  /home/runner/work/rix/rix/vignettes/_env_1_R-4-1-3  #>  #> * current R session running outside Nix environment and not 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 #>  #> ==> Also adjusting `PATH` via `Sys.setenv()`, so that system commands can invoke key Nix commands like `nix-build` in this RStudio session outside Nix #>  #>  #> ### Successfully generated `default.nix` and `.Rprofile` ### #> # This file was generated by the {rix} R package v0.9.1 on 2024-08-08 #> # 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":"now 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. 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\",   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\",   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(   r_ver = \"4.2.0\",   overwrite = TRUE,   project_path = path_env_1_2,   shell_hook = \"R\" ) #>  #> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #>  #> ==> Existing isolated nix-R project folder: #>  /home/runner/work/rix/rix/vignettes/_env_1_2_R-4-2-0  #>  #> * current R session running outside Nix environment and not 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 #>  #> ==> Also adjusting `PATH` via `Sys.setenv()`, so that system commands can invoke key Nix commands like `nix-build` in this RStudio session outside Nix #>  #>  #> ### Successfully generated `default.nix` and `.Rprofile` ###  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\",   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: 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(   r_ver = \"4.3.1\",   r_pkgs = \"stringr@1.4.1\",   overwrite = TRUE,   project_path = path_env_stringr ) #>  #> ### Bootstrapping isolated, project-specific, and runtime-pure R setup via Nix ### #>  #> ==> Existing isolated nix-R project folder: #>  /home/runner/work/rix/rix/vignettes/_env_stringr_1.4.1  #>  #> * current R session running outside Nix environment and not 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 #>  #> ==> Also adjusting `PATH` via `Sys.setenv()`, so that system commands can invoke key Nix commands like `nix-build` in this RStudio session outside Nix #>  #>  #> ### Successfully generated `default.nix` and `.Rprofile` ###  list.files(path = path_env_stringr, all.files = TRUE) #> [1] \".\"           \"..\"          \".Rprofile\"   \"default.nix\" out_nix_stringr <- with_nix(   expr = function() stringr::str_subset(c(\"\", \"a\"), \"\"),   program = \"R\",   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(   r_ver = \"4.1.1\",   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\",   project_path = path_env_arrow,   message_type = \"simple\" )"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-using-nix-inside-docker.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"z - Advanced topic: Using Nix inside Docker","text":"might look like Nix alternative Docker, ’s really case. Docker containerisation tool, Nix package manager. can use Nix way don’t need Docker anymore, ’re already invested Docker, don’t abandon can still benefit Nix.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-using-nix-inside-docker.html","id":"a-generic-dockerfile","dir":"Articles","previous_headings":"","what":"A generic Dockerfile","title":"z - Advanced topic: Using Nix inside Docker","text":"Dockerfile uses ubuntu:latest base image, uses Nix package manager set complete development environment: doesn’t matter using ubuntu:latest base image, usually recommended reproducibility purposes, since Nix takes care ensuring environment reproducible. example generate_env.R file: Using Nix handle setup environment, even inside Docker, creates nice separation concerns. one hand, can continue using Docker serve applications, hand, can use Nix ensure don’t store images, can always rebuild correct environment completely reproducible manner.","code":"FROM ubuntu:latest  RUN apt update -y  RUN apt install curl -y  # We don't have R nor {rix} in this image, so we can bootstrap it by downloading # the default.nix file that comes with {rix}. You can also download it beforehand # and then copy it to the Docker image RUN curl -O https://raw.githubusercontent.com/b-rodrigues/rix/master/inst/extdata/default.nix  # Copy a script to generate the environment of interest using {rix} COPY generate_env.R .  # The next 4 lines install Nix inside Docker. See the Determinate Systems installer's documentation RUN curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux \\   --extra-conf \"sandbox = false\" \\   --init none \\   --no-confirm  # Adds Nix to the path, as described by the Determinate Systems installer's documentation ENV PATH=\"${PATH}:/nix/var/nix/profiles/default/bin\"  # This will overwrite the default.nix we downloaded previously with a new # expression generated from running `generate_env.R` RUN nix-shell --run \"Rscript generate_env.R\"  # We now build the environment RUN nix-build  # Finally, we run `nix-shell`. This will get executed when running # containers from this image. You can of course put anything in here CMD nix-shell library(rix)  rix(   r_ver = \"4.3.1\",   r_pkgs = c(\"dplyr\", \"ggplot2\"),   ide = \"other\",   project_path = \".\",   shell_hook = \"R\",   overwrite = TRUE )"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-using-nix-inside-docker.html","id":"dockerizing-a-shiny-application","dir":"Articles","previous_headings":"","what":"Dockerizing a Shiny application","title":"z - Advanced topic: Using Nix inside Docker","text":"Dockerizing Shiny application using Nix easy well. can keep almost exactly Dockerfile , need add required ui.R server.R files (files needed app), expose port want: adapt generate_env.R script: code simple Shiny app (’s K-means app Shiny examples gallery): ui.R: server.R: Build image : run container :","code":"FROM ubuntu:latest  RUN apt update -y  RUN apt install curl -y  # Get a default.nix with R and rix RUN curl -O https://raw.githubusercontent.com/b-rodrigues/rix/master/inst/extdata/default.nix  # Copy a script to generate the environment of interest using rix COPY generate_env.R .  # Copy the required scripts for the app COPY ui.R . COPY server.R .  RUN curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux \\   --extra-conf \"sandbox = false\" \\   --init none \\   --no-confirm  ENV PATH=\"${PATH}:/nix/var/nix/profiles/default/bin\"  # This will overwrite the default.nix we downloaded with a new one RUN nix-shell --run \"Rscript generate_env.R\"  EXPOSE 3838  RUN nix-build  CMD nix-shell --run 'Rscript -e \"shiny::runApp(port = 3838, host = \\\"0.0.0.0\\\")\"' library(rix)  rix(   r_ver = \"4.2.2\",   r_pkgs = \"shiny\",   ide = \"other\",   project_path = \".\",   overwrite = TRUE ) # k-means only works with numerical variables, # so don't give the user the option to select # a categorical variable vars <- setdiff(names(iris), \"Species\")  pageWithSidebar(   headerPanel(\"Iris k-means clustering\"),   sidebarPanel(     selectInput(\"xcol\", \"X Variable\", vars),     selectInput(\"ycol\", \"Y Variable\", vars, selected = vars[[2]]),     numericInput(\"clusters\", \"Cluster count\", 3, min = 1, max = 9)   ),   mainPanel(     plotOutput(\"plot1\")   ) ) function(input, output, session) {   # Combine the selected variables into a new data frame   selectedData <- reactive({     iris[, c(input$xcol, input$ycol)]   })    clusters <- reactive({     kmeans(selectedData(), input$clusters)   })    output$plot1 <- renderPlot({     palette(c(       \"#E41A1C\", \"#377EB8\", \"#4DAF4A\", \"#984EA3\",       \"#FF7F00\", \"#FFFF33\", \"#A65628\", \"#F781BF\", \"#999999\"     ))      par(mar = c(5.1, 4.1, 0, 1))     plot(selectedData(),       col = clusters()$cluster,       pch = 20, cex = 3     )     points(clusters()$centers, pch = 4, cex = 4, lwd = 4)   }) } docker build -t shiny_app . docker run --rm -p 3838:3838 --name my_container shiny_app"},{"path":"https://b-rodrigues.github.io/rix/articles/z-advanced-topic-using-nix-inside-docker.html","id":"nixos","dir":"Articles","previous_headings":"","what":"NixOS","title":"z - Advanced topic: Using Nix inside Docker","text":"can also image NixOS Docker image instead Ubuntu, case don’t need install Nix. NixOS full GNU/Linux distribution uses Nix system package manager.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-binary_cache.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"z - Advanced topic: Rolling out your own binary cache","text":"core, Nix package manager installs software source, can take long time. example, installing R RStudio source take several hours, depending hardware. R packages also must compiled, depending environment need, take several hours build. practice however, rarely case , packages get pre-built made available NixOS’s public cache. Nix package manager first checks need public cache, yes, downloads binary instead building computer. means building environment just matter waiting packages download. However, cases, might need use packages pre-built cached yet, example use rix(r_ver = \"bleeding_edge\") rix(r_ver = “frozen_edge”)` generate environments bleeding edge packages. Building environments potentially take quite long, packages need built source computer. vignette explain can cut building times building environment , cache , don’t need rebuild new machines. rolling cache, try using explained vignette(\"z-bleeding_edge\"), cache didn’t cover needs, set . vignette explains .","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-binary_cache.html","id":"using-github-actions-to-build-the-environment","dir":"Articles","previous_headings":"","what":"Using Github Actions to build the environment","title":"z - Advanced topic: Rolling out your own binary cache","text":"creating cache hold binaries development environment, first need build environment . can build environment computer, Github Actions. advantage using Github Actions can automate process building pushing binaries time change definition environment. example, imagine following generate_env.R file project, version Github: add packages , re-run , ’ll end new default.nix file, need rebuild environment. , depending packages include, take quite time build. generate Github Actions workflow file build environment Github Actions, run rix::ga_cachix(cache_name = \"\", path = \"\") cache_name name cache made Cachix, path path default.nix file generated generate_env.R. default, environment gets rebuilt every time push changes master/main branch repository, can also re-build environment periodically, changing lines: : using cron syntax can specify often want environment re-built. can useful need develop current state CRAN every day (instance, package development).","code":"library(rix)  rix(r_ver = \"bleeding_edge\",     r_pkgs = c(\"dplyr\", \"ggplot2\"),     system_pkgs = NULL,     git_pkgs = NULL,     tex_pkgs = NULL,     ide = \"rstudio\",     project_path = \".\") on:   push:     branches: [ master, main ] on:   push:     branches: [ master, main ]   schedule:     - cron: '30 0 * * *'"},{"path":"https://b-rodrigues.github.io/rix/articles/z-binary_cache.html","id":"using-your-cache","dir":"Articles","previous_headings":"","what":"Using your cache","title":"z - Advanced topic: Rolling out your own binary cache","text":"Whether decide build packages Github locally, use cache, need open account Cachix. free tier includes 5GB space, enough several development environments. account done, create personal auth token Github Actions workflow (computer, building locally) can authenticate Cachix account. , copy token, go Github repository’s settings, Secrets variables > Actions add new repository secret. Copy token Secret field name secret CACHIX_AUTH. Now action can authenticate Cachix push binaries builds! building locally, simply run cachix authtoken  terminal building (follow instructions Cachix website learn push binaries afterwards). use personalized cache computers, run following commands computer. First, install Cachix client: use cache: Anyone can pull binaries cache, work team, can ensure everyone can benefit . can also use several caches , NixOS’s public cache, rstats--nix cache, , cache end holding binaries found two caches! Take look package’s repository example done practice.","code":"nix-env -iA cachix -f https://cachix.org/api/v1/install cachix use your-cache-name"},{"path":"https://b-rodrigues.github.io/rix/articles/z-bleeding_edge.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"z - Advanced topic: Understanding the rPackages set release cycle and using bleeding edge packages","text":"important understand release cycle rPackages set steps take need bleeding edge packages. R packages nixpkgs tend get updated alongside new release R, reason ensure certain level quality. vast majority CRAN (Bioconductor) packages made available nixpkgs fully automated way. packages require manual intervention work Nix, know try build packages, building packages requires quite lot resources. can’t build CRAN packages every single day see everything works well Nix, rebuild whole tree whenever ’s new release R. Packages get built CI infrastructure called Hydra, packages get cached cache.nixos.org whenever someone wants install package, pre-built binary gets download cache. avoids build software source locally. packages don’t need compiling big time save, packages need get compiled huge. Depending packages want install, build everything source, potentially take hours, can install pre-built binaries ’s just matter quick internet connection .","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-bleeding_edge.html","id":"r-packages-available-through-nix","dir":"Articles","previous_headings":"","what":"R packages available through Nix","title":"z - Advanced topic: Understanding the rPackages set release cycle and using bleeding edge packages","text":"explained introduction, rPackages set nixpkgs gets updated shortly new release R. process involves first updating package definitions found , building whole tree CI platform called Hydra. Build failures get fixed volunteers (learn can contribute, read vignette(\"z-contributing_to_nixpkgs\")). important packages fixed, whole rPackages set gets updated made available nixpkgs master branch. Essentially means start project rix using \"latest\" r_ver just rPackages set got updated, project use fresh packages. instead start project just R release, environment using older packages. practice rarely matters, unless absolutely need recent version specific package need specific feature, need environment bleeding edge packages development. cases like , provide r_ver = \"bleeding_edge\" r_ver = \"frozen_edge\" options makes possible use recent packages environment, cost. must aware cost detail next section.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-bleeding_edge.html","id":"using-bleeding-and-frozen-edge-package-for-your-environments","dir":"Articles","previous_headings":"","what":"Using bleeding and frozen edge package for your environments","title":"z - Advanced topic: Understanding the rPackages set release cycle and using bleeding edge packages","text":"CRAN continuously getting new updated packages. use R outside Nix, running install.packages(pkg) install latest version {pkg} package available CRAN (unless changed default repository url). Nix, packages get downloaded CRAN nixpkgs repository may outdated explained . require bleeding edge packages, use \"bleeding_edge\" option r_ver. download packages official nixpkgs repository anymore, fork maintain can find . fork gets updated every 12 hours latest commits nixpkgs repository CRAN. means environments generated using fork contain bleeding packages CRAN (Bioconductor) packages well system-level dependencies. Also, aware generate expression reproducible! time rebuild environment generated using \"bleeding_edge\" option, get exactly : environment bleeding edge packages build time. want instead bleeding edge packages time generate expression, want reproducibility (words, building always result environment), use \"frozen_edge\" option instead. case, whatever option choose, using comes cost must aware. First, packages bleeding edge, chance built Hydra yet. Hydra periodically builds packages get cached. ’re using Nix, pre-compiled binaries get used instead built source. case use fork, unless also use cache provide, courtesy cachix.org. Cachix provides cache projects works seamlessly official Nix cache. However, limited space, possible cache CRAN packages. popular packages get built cached, hopefully packages need part limited set. use cache, run following commands computer. First, install Cachix client: use cache: ’s ! Packages now get pulled official cache, also dedicated rstats--nix cache. cache also contains latest version R, sometimes can also lag behind official nixpkgs repository.","code":"nix-env -iA cachix -f https://cachix.org/api/v1/install cachix use rstats-on-nix"},{"path":"https://b-rodrigues.github.io/rix/articles/z-bleeding_edge.html","id":"making-your-own-cache","dir":"Articles","previous_headings":"","what":"Making your own cache","title":"z - Advanced topic: Understanding the rPackages set release cycle and using bleeding edge packages","text":"need packages included rstats--nix cache, can easily roll binary cache. Simply build environment one machine, push binaries cache re-use. Refer vignette vignette(\"z-binary_cache\") learn set cache.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"z - Advanced topic: Contributing to nixpkgs","text":"want help us make R ecosystem better Nix fixing packages, read ! Vignette help help us! lists common ways packages can break teaches fix R packages inclusion nixpkgs. Every package available CRAN Bioconductor gets built Hydra made available rPackages package set. ’s need manually package . However, packages don’t build successfully, require manual fixing. quick, one-line fixes, others require bit work. goal Vignette make quickly familiar main reasons package may broken explain fix , certain packages get fixed certain ways. vignette assumes comfortable Git concepts branches PRs (pull requests) compiling software Linux.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"setting-up","dir":"Articles","previous_headings":"","what":"Setting up","title":"z - Advanced topic: Contributing to nixpkgs","text":"first need set thing. Fork nixpkgs repository clone computer. , add original repository remote: way, time want fix package, can fetch latest updates upstream merge local copy: Make sure merge latest commits upstream regularly, nixpkgs gets updated frequently day. can now look package fix. reason update local copy, make sure ’re master reset hard: Always make sure create new branch fix package, don’t work master, ’ll just asking trouble! might also want join Matrix chat room coordinate efforts. can join .","code":"git checkout master  # Add upstream as a remote git remote add upstream git@github.com:NixOS/nixpkgs.git # Fetch latest updates git fetch upstream  # Merge latest upstream/master to your master git merge upstream/master git reset --hard upstream/master"},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"where-to-find-packages-to-fix","dir":"Articles","previous_headings":"","what":"Where to find packages to fix","title":"z - Advanced topic: Contributing to nixpkgs","text":"first step help fix package find package fix: visit latest rPackages evaluation . Click “Still failing jobs” tab see packages’ builds didn’t succeed click package. see something like : , can see {AIUQ}’s build failed another package, {SuperGauss}, fixing {SuperGauss} likely fix one well. can look {SuperGauss} “Still failing jobs” tab, see {SuperGauss} failed, check little dashboard built can find . dashboard shows essentially information find “Still failing jobs” tab , several added niceties. First , ’s column called fails_because_of shows name package caused another fail. example {AIUQ}, {SuperGauss} listed (package fails another reason, like missing system-level dependency, name listed ). can type {SuperGauss} little box filter see packages fail . , can also see package’s package rank. rank computed using packageRank package, table sorted lowest rank (low ranks indicate high popularity ’s also percentile column indicates percentage packages higher downloads). Finally, ’s direct link PR fixing package (opened) also PR’s status: merged already ? link PR quite useful, immediately tells someone already tried fixing . PR merged, simply try another fix package. PR open yet merged, great opportunity help review ()! Let’s go back fixing {SuperGauss}. go back Hydra, can see error message thrown building: Click logfile (either pretty, raw tail) see happened. ’s see: issue system-level dependencies missing, pkg-config FFTW, need add fix build. brings us first recipe cookbook!","code":"checking for pkg-config... no checking for FFTW... configure: error: in `/build/SuperGauss': configure: error: The pkg-config script could not be found or is too old.  Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config.  Alternatively, you may set the environment variables FFTW_CFLAGS and FFTW_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.  To get pkg-config, see . See `config.log' for more details ERROR: configuration failed for package 'SuperGauss' * removing '/nix/store/jxv5p85x24xmfcnifw2ibvx9jhk9f2w4-r-SuperGauss-2.0.3/library/SuperGauss'"},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"case-1-packages-that-need-dependencies-to-build","dir":"Articles","previous_headings":"","what":"Case 1: packages that need dependencies to build","title":"z - Advanced topic: Contributing to nixpkgs","text":"Fixing packages require system-level dependencies matter adding one, maybe two lines, right place expression defines whole rPackages set. can find file . , find line starts packagesWithNativeBuildInputs = { another starts packagesWithBuildInputs = { define long list packages. difference NativeBuildInputs BuildInputs dependencies needed compilation get listed NativeBuildInputs (things like compilers packages pkg-config) dependencies needed run-time (dynamic libraries) get listed BuildInputs. R, actually, put everything NativeBuildInputs still work, try pay attention properly. case doubt, put everything NativeBuildInputs: reviewing PR, people tell put . anything else, try build package. following line drop interactive Nix shell package build succeeds (run command root cloned nixpkgs directory): see error Hydra, made sure PR opened, can start fixing package. , need add two dependencies. Let’s read relevant lines error message : look default.nix file, particular two lists define packages need nativeBuildInputs buildInputs, ’ll see many pkg-config listed already. let’s add following line packagesWithNativeBuildInputs one packagesWithBuildInputs: pkg-config needed compile {SuperGauss} fftw.dev needed run-time well. Try build shell {SuperGauss} : worked, start R load library. Sometimes packages can build successfully fail launch, taking time load avoids wasting reviewer’s time. Ideally, try run one several examples package’s vignette help files. also makes sure everything working properly. testing succeeded, can now open PR! committing, make sure seprate branch fix (can changes master long don’t commit change branch): , make sure default.nix file changed: Sometimes, running examples may produce files, ’s case get rid . files added case add default.nix commit write following commit message: commit message follows nixpkgs’s contributing guidelines. Format messages like . Now push changes: go fork’s repository open PR. Congratulations, fixed first package!","code":"nix-shell -I nixpkgs=. -p R rPackages.SuperGauss configure: error: The pkg-config script could not be found or is too old.  Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config.  Alternatively, you may set the environment variables FFTW_CFLAGS and FFTW_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. SuperGauss = [ pkgs.pkg-config ]; SuperGauss = [ pkgs.fftw.dev ]; nix-shell -I nixpkgs=. -p R rPackages.SuperGauss git checkout -b fix_supergauss git status user@computer:~/Documents/nixpkgs(fix_supergauss *)$ git status On branch fix_supergaus Changes not staged for commit:   (use \"git add ...\" to update what will be committed)   (use \"git restore ...\" to discard changes in working directory)     modified:   pkgs/development/r-modules/default.nix  no changes added to commit (use \"git add\" and/or \"git commit -a\") git add . git commit -m \"rPackages.SuperGauss: fixed build\" git push origin fix_supergauss"},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"case-2-packages-that-need-a-home-x-or-simple-patching","dir":"Articles","previous_headings":"","what":"Case 2: packages that need a home, X, or simple patching","title":"z - Advanced topic: Contributing to nixpkgs","text":"package may require /home directory installation process. usually fail message looks like : add package list named packagesRequiringHome try rebuilding. See PR example: https://github.com/NixOS/nixpkgs/pull/292336 packages require X, X11, windowing system Linux distributions. words, pacakges must installed machine graphical session running. ’s case Hydra, needs mocked. Simply add package list named packagesRequiringX try rebuilding. See PR https://github.com/NixOS/nixpkgs/pull/292347 example. Finally, packages must compiled need first configured. common step compiling software. configuration step ensures needed dependencies found (among things). Nix works way , can happen configuration step fails dependencies usual /usr/bin /bin, etc, paths. needs patched configuration step. fix , configuration file lists different dependencies found needs patched, can done overriding one phases configure phase. override postPatch phase like : Read patchShebangs . See PR example: https://github.com/NixOS/nixpkgs/pull/289775 Sometimes patching bit complicated. See example .","code":"Warning in normalizePath(\"~\") :   path[1]=\"/homeless-shelter\": No such file or directory RcppCGAL = old.RcppCGAL.overrideAttrs (attrs: {   postPatch = \"patchShebangs configure\"; });"},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"case-3-packages-that-require-their-attributes-to-be-overridden","dir":"Articles","previous_headings":"","what":"Case 3: packages that require their attributes to be overridden","title":"z - Advanced topic: Contributing to nixpkgs","text":"Staying topic overrides, can also happen packages need one attributes overridden. already much complex cases , error messages may hint attributes override can much cryptic. example, ’s build log xslt: hint url pointing gcc’s manual entry -fpermissive flag. happened code raises warning compilation: without flag, warning gets turned error. need add flag compilation “tolerate” warning. ’s done xslt: attribute override NIX_CFLAGS_COMPILE attribute. add -fpermissive flags ’re good go. Check PR complete {xlst} example:https://github.com/NixOS/nixpkgs/pull/292329 Also take time read examples overrides default.nix file learn common attributes need overridden.","code":"Running phase: unpackPhase unpacking source archive /nix/store/gxcysc8y3x1wz7qz3q1fpv8g8f92iqyv-xslt_1.4.4.tar.gz source root is xslt setting SOURCE_DATE_EPOCH to timestamp 1676995202 of file xslt/MD5 Running phase: patchPhase Running phase: updateAutotoolsGnuConfigScriptsPhase Running phase: configurePhase Running phase: buildPhase Running phase: checkPhase Running phase: installPhase * installing *source* package 'xslt' ... ** package 'xslt' successfully unpacked and MD5 sums checked ** using staged installation Found pkg-config cflags and libs! Using PKG_CFLAGS=-I/nix/store/8jkj0gm1chw8rhpqbpljydlwsm6hmgwp-libxslt-1.1.39-dev/include -I/nix/store/iqjsxkcdnvvz1bfpq960ygicc5clz9hv-libxml2-2.12.3-unstable-2023-12-14-dev/include/libxml2 Using PKG_LIBS=-L/nix/store/ksp5m4p5fi1d8zvhng96qqzy1wqc51v6-libxslt-1.1.39/lib -L/nix/store/4jvs7wz2jfmc6x9zgngfcr9804x9hwln-libxml2-2.12.3-unstable-2023-12-14/lib -lexslt -lxslt -lxml2 ** libs using C++ compiler: 'g++ (GCC) 13.2.0' rm -f RcppExports.o xslt.o xslt_init.o xslt.so /nix/store/xq8920m5mbd83vdlydwli7qsh67gfm5v-gcc-wrapper-13.2.0/bin/c++ -std=gnu++17 -I\"/nix/store/403kbh5v910gks340j7s1647kijm60rv-R-4.3.2/lib/R/include\" -DNDEBUG -I/nix/store/8jkj0gm1chw8rhpqbpljydlwsm6hmgwp-libxslt-1.1.39-dev/include -I/nix/store/iqjsxkcdnvvz1bfpq960ygicc5clz9hv-libxml2-2.12.3-unstable-2023-12-14-dev/include/libxml2 -DSTRICT_R_HEADERS -I'/nix/store/0vzi341m7nbxhdbi8kj50nwn7rrssk5z-r-Rcpp-1.0.12/library/Rcpp/include' -I'/nix/store/h6z1v3qb2pxhb3yjrykdaircz3xk1jla-r-xml2-1.3.6/library/xml2/include'     -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o /nix/store/xq8920m5mbd83vdlydwli7qsh67gfm5v-gcc-wrapper-13.2.0/bin/c++ -std=gnu++17 -I\"/nix/store/403kbh5v910gks340j7s1647kijm60rv-R-4.3.2/lib/R/include\" -DNDEBUG -I/nix/store/8jkj0gm1chw8rhpqbpljydlwsm6hmgwp-libxslt-1.1.39-dev/include -I/nix/store/iqjsxkcdnvvz1bfpq960ygicc5clz9hv-libxml2-2.12.3-unstable-2023-12-14-dev/include/libxml2 -DSTRICT_R_HEADERS -I'/nix/store/0vzi341m7nbxhdbi8kj50nwn7rrssk5z-r-Rcpp-1.0.12/library/Rcpp/include' -I'/nix/store/h6z1v3qb2pxhb3yjrykdaircz3xk1jla-r-xml2-1.3.6/library/xml2/include'     -fpic  -g -O2  -c xslt.cpp -o xslt.o /nix/store/xq8920m5mbd83vdlydwli7qsh67gfm5v-gcc-wrapper-13.2.0/bin/c++ -std=gnu++17 -I\"/nix/store/403kbh5v910gks340j7s1647kijm60rv-R-4.3.2/lib/R/include\" -DNDEBUG -I/nix/store/8jkj0gm1chw8rhpqbpljydlwsm6hmgwp-libxslt-1.1.39-dev/include -I/nix/store/iqjsxkcdnvvz1bfpq960ygicc5clz9hv-libxml2-2.12.3-unstable-2023-12-14-dev/include/libxml2 -DSTRICT_R_HEADERS -I'/nix/store/0vzi341m7nbxhdbi8kj50nwn7rrssk5z-r-Rcpp-1.0.12/library/Rcpp/include' -I'/nix/store/h6z1v3qb2pxhb3yjrykdaircz3xk1jla-r-xml2-1.3.6/library/xml2/include'     -fpic  -g -O2  -c xslt_init.cpp -o xslt_init.o xslt_init.cpp: In function 'void R_init_xslt(DllInfo*)': xslt_init.cpp:36:37: error: invalid conversion from 'void (*)(void*, xmlError*)' {aka 'void (*)(void*, _xmlError*)'} to 'xmlStructuredErrorFunc' {aka 'void (*)(void*, const _xmlError*)'} [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-fpermissive-fpermissive8;;]    36 |     xmlSetStructuredErrorFunc(NULL, handleError);       |                                     ^~~~~~~~~~~       |                                     |       |                                     void (*)(void*, xmlError*) {aka void (*)(void*, _xmlError*)} In file included from xslt_init.cpp:4: /nix/store/iqjsxkcdnvvz1bfpq960ygicc5clz9hv-libxml2-2.12.3-unstable-2023-12-14-dev/include/libxml2/libxml/xmlerror.h:898:57: note:   initializing argument 2 of 'void xmlSetStructuredErrorFunc(void*, xmlStructuredErrorFunc)'   898 |                                  xmlStructuredErrorFunc handler);       |                                  ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ make: *** [/nix/store/403kbh5v910gks340j7s1647kijm60rv-R-4.3.2/lib/R/etc/Makeconf:200: xslt_init.o] Error 1 ERROR: compilation failed for package 'xslt' * removing '/nix/store/1p4qp17ccjvi53g3vl67j3z8n1lp61m3-r-xslt-1.4.4/library/xslt' xslt = old.xslt.overrideAttrs (attrs: {   env = (attrs.env or { }) // {     NIX_CFLAGS_COMPILE = attrs.env.NIX_CFLAGS_COMPILE + \" -fpermissive\";   }; });"},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"case-4-packages-that-need-a-dependency-that-must-be-overridden","dir":"Articles","previous_headings":"","what":"Case 4: packages that need a dependency that must be overridden","title":"z - Advanced topic: Contributing to nixpkgs","text":"Sometimes attribute package needs overriden, one dependencies. example, opencv R packages requires opencv software compiled using specific configuration option enableGtk2 = true. However, version opencv available nixpkgs doesn’t flag set true. ’s issue, since can override . See PR see done. Another interesting example PR fixing hdf5r. Even though merged end, still think study , solution tried quite instructive! Finally, ’s example fixing {arrow}. included comment explains ’s happening quite well won’t rewrite .","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"case-5-darwin-specific-fixes","dir":"Articles","previous_headings":"","what":"Case 5: darwin-specific fixes","title":"z - Advanced topic: Contributing to nixpkgs","text":"Darwin (macOS) may require specific fixes packages work. won’t detail , don’t required hardware, can look pkgs/development/r-modules/default.nix file darwin-specific fixes. Look “darwin” string find several examples.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"case-6-an-r-packages-requires-software-not-in-nixpkgs-or-outdated-in-nixpkgs","dir":"Articles","previous_headings":"","what":"Case 6: an R packages requires software not in nixpkgs (or outdated in nixpkgs)","title":"z - Advanced topic: Contributing to nixpkgs","text":"R packages depend software function. instance, {RQuantlib} requires quantlib outdated nixpkgs leading build failure. PR, ’ll see first quantlib got updated, {RQuantlib} fixed. Another example: Rsymphony required Symphony optimizer available, completely missing nixpkgs. example, ’ll see Symphony added nixpkgs {RSymphony} fixed","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"study-study-study-study","dir":"Articles","previous_headings":"","what":"Study! Study! Study! Study!","title":"z - Advanced topic: Contributing to nixpkgs","text":"best way learn, read already done others. guide can hopefully get started quickly, highly recommend check PRs opened merged . stated already, don’t hesitate join Matrix channel need help get started!","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"broken-packages","dir":"Articles","previous_headings":"","what":"Broken packages","title":"z - Advanced topic: Contributing to nixpkgs","text":"Finally, packages “broken”. packages absolutely require something function Nix easily provide: instance, packages must connect internet download stuff installation time. building Nix happens sandbox ensure purity, packages work, unless way circumvent need connection. example, PR see possible download content required build time beforehand, installation can still succeed. packages require example linked proprietary software, Rcplex. also possible fix package, little incentive require get evaluation version software fix package. However, build still listed failing Hydra, get proprietary software (even evaluation version) installed . Also, require quite effort keep maintaining. suggest packages “broken”, add brokenPackages list pkgs/development/r-modules/default.nix.","code":""},{"path":"https://b-rodrigues.github.io/rix/articles/z-contributing_to_nixpkgs.html","id":"reviewing-prs","dir":"Articles","previous_headings":"","what":"Reviewing PRs","title":"z - Advanced topic: Contributing to nixpkgs","text":"accelerate merging PRs, always helps people review first! want help reviewing, can proceed follows. First, highly recommend use following script put together Kupac: Save file called rpkg-pr-review (whatever prefer) $PATH (example, home//bin/, make sure folder $PATH) make executable: Find PR need review. Find commit ID PR: can now use script saved : Replace COMMIT_ID Git commit ID PR, pkg1 pkg2 package(s) need review. download everything needed drop interactive radian shell can test packages (prefer standard R shell, replace radianWrapper rWrapper, radian pretty neat, give go!) can test package works, try examples . can also check fix : understand fix works? done differently? can make suggestions committer . , can also approve PR Github’s interface:","code":"#!/usr/bin/env bash  nix-shell -p \"radianWrapper.override{packages = with rPackages; [ ${*:2} ];}\" \\           -I nixpkgs=\"https://github.com/nixos/nixpkgs/archive/$1.tar.gz\" --run radian chmod +x rpkg-pr-review rpkg-pr-review COMMIT_ID pkg1 pkg2"},{"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.9.1, 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.9.1},   url = {https://b-rodrigues.github.io/rix/}, }"},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"rix-reproducible-environments-with-nix-","dir":"","previous_headings":"","what":"Rix: Reproducible Environments with Nix","title":"Rix: Reproducible Environments with Nix","text":"Introduction Quick start returning users Docker Docker renv Ana/Miniconda Mamba Nix different Guix? rix ? Contributing Thanks Recommended reading","code":""},{"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). project-specific environment also include required system-level dependencies can difficult install, GDAL packages geospatial analysis example. Nix installs software complete “bundle” include software’s dependencies, dependencies’ dependencies . Nix incredibly useful piece software ensuring reproducibility projects, research otherwise. use cases include, example, running web applications like Shiny apps plumber APIs controlled environment, executing targets pipelines right version R dependencies, use environments managed Nix work interactively using IDE. essence, means can use rix Nix replace renv Docker one single tool, approach quite different: renv records specific versions individual packages, rix provides complete snapshot R ecosystem specific point time, also snapshots required dependencies make project-specific R environment work. contrast, ensure complete reproducibility renv, must combined Docker, order include system-level dependencies (like GDAL, per example ). Nix fairly steep learning curve though. Nix complex piece software comes programming language, also called Nix. purpose solve complex problem: defining instructions build software packages manage configurations declarative way, using functional programming principles. makes sure software gets installed fully reproducible manner, operating system hardware, caveat users must learn Nix programming language get “functional programming approach software management” mindset, unusual. rix provides functions help write 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 includes currently 100.000 pieces software available Nix package manager. rix, can define development environments, shells, contain required tools needed analyze data using R. environments isolated project-specific: means project can use one version R R packages, another environment another version R R packages. However, extra care required already R installed usual method operating system, development environments totally isolated rest system. Unlike Docker, running container acces anything host system, unless explicitely configured , Nix development shells nothing environments add software list already available software (-called PATH). , possible access anything (files software) already present system running Nix shell. Thus, rix also provides function called rix_init() helps isolate R sessions running inside Nix environments rest system. avoids clashes Nix-specific library R packages user library R packages already R installed managed usual method operating system. also possible add software package available Nixpkgs Nix environment, example IDEs RStudio VS Code. Nix R ecosystem currently includes almost entirety CRAN Bioconductor packages (around hundred CRAN Biocondcuctor packages unavailable Nix). Like programming language software, also possible install older releases R packages, install packages GitHub defined states, well local packages .tar.gz format. 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. need tools languages like Python Julia, can also done easily. Nix available Linux, macOS Windows (via WSL2) rix comes following features: define complete development environments code use anywhere; install project-specific complete R environments, can different ; 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: Now try build expression using rix(): generates file called default.nix path path_default_nix correct expression build environment. build environment, Nix package manager must installed. Nix installed, can build expression using nix-build terminal command enter environment using nix-shell. vignettes included package walk whole workflow.","code":"install.packages(\"rix\", repos = c(   \"https://b-rodrigues.r-universe.dev\",   \"https://cloud.r-project.org\" ))  library(\"rix\") library(rix)  path_default_nix <- \".\"  rix(   r_ver = \"4.3.3\",   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. know , read vignette(\"z-advanced-topic-using-nix-inside-docker\") link.","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"docker-and-renv","dir":"","previous_headings":"How is Nix different from Docker+renv/{groundhog}/{rang}/(Ana/Mini)Conda/Guix? or Why Nix?","what":"Docker and renv","title":"Rix: Reproducible Environments with Nix","text":"Let’s start arguably popular combo reproducibility R ecosystem, Docker+renv (also possible add rspm bspm combination renv install required system-level dependencies automatically). {renv} snapshots state library R packages project, nothing , nothing less. can used restore library packages another machine, user’s responsibility ensure right version R system-level dependencies available machine. whay renv often coupled versioned Docker image, images Rocker project. Combining provides robust way serve applications Shiny apps, can awkward develop interactively setup, time, people work current setup, dockerize setup ’re done. However, need make sure keep updating image, underlying operating system eventually reach end life. Eventually, might even update whole stack become impossible install version R R packages used recent Docker image. can good thing actually; opportunity update app make sure benefits latest security patches. However reproducibility research, something impact historical results. suggest instead, keep using Docker already invested ecosystem, continue use deploy serve applications archive research. instead using renv get right packages, combine Docker Nix. way, nice separation concerns: Docker used platter serve code, environment handled Nix. even use image gets continuously updated ubuntu:latest base: doesn’t matter image always changing, since environment heavy lifting inside container completely reproducible thanks Nix. Exactly reasoning can applied groundhog, rang CRAN snapshots Posit combination Docker instead renv.","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"anamini-conda-and-mamba","dir":"","previous_headings":"How is Nix different from Docker+renv/{groundhog}/{rang}/(Ana/Mini)Conda/Guix? or Why Nix?","what":"Ana/Mini-conda and Mamba","title":"Rix: Reproducible Environments with Nix","text":"Anaconda, Miniconda, Mamba, Micromamba… (henceforth ’ll refer Conda) Nix much common: multiplatform package managers can used setup reproducible development environments many languages, R Python. Using conda-lock one can generate fully reproducible lock files can used Conda build environment defined lock file. main difference Conda Nix conceptual might seem important end-users: Conda procedural package manager, Nix functional package manager. practice means environments managed Conda mutable users prevented changing environment interactively, re-generate lock file. quite comfortable working interactively, can lead issues dependency management might get borked. case Nix however, environments immutable: add software running Nix environment. need stop working, re-define environment, rebuild use . might sound tedious () forces users work “cleanly” avoids many issues dynamically changing environment. possible build environment, fails early possible forces deal issue. mutating environment lead false sense safeness. Another major difference Conda include entirety CRAN Bioconductor, case Nix. According Anaconda’s Documentation 6000 CRAN packages available Conda (writing July 2024, CRAN 21’000+ packages). Nix also includes almost Bioconductor packages, Conda includes trough Bioconda project, however, able find Bioconda contains Bioconductor. According Bioconda’s FAQ, Bioconductor data packages included.","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"how-is-nix-different-from-guix","dir":"","previous_headings":"How is Nix different from Docker+renv/{groundhog}/{rang}/(Ana/Mini)Conda/Guix? or Why Nix?","what":"How is Nix different from Guix?","title":"Rix: Reproducible Environments with Nix","text":"Just like Nix, Guix functional package manager focus reproducible builds. won’t go technical differences/similarities, pratical ones end-users R programming language. want know technical aspects, read https://news.ycombinator.com/item?id=18910683. main shortcoming Guix R users CRAN Bioconductor packages included, Guix available Windows macOS.","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"is-rix-all-there-is","dir":"","previous_headings":"How is Nix different from Docker+renv/{groundhog}/{rang}/(Ana/Mini)Conda/Guix? or Why Nix?","what":"Is {rix} all there is?","title":"Rix: Reproducible Environments with Nix","text":", tools might want check , especially want set polyglot environments (even though possible use rix set environment R Python packages example). Take look https://devenv.sh/ https://prefix.dev/ want explore tools make using Nix easier!","code":""},{"path":"https://b-rodrigues.github.io/rix/index.html","id":"contributing","dir":"","previous_headings":"","what":"Contributing","title":"Rix: Reproducible Environments with Nix","text":"Refer Contributing.md learn contribute package.","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). Finally, thanks David Solito creating rix’s logo!","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":"Nix revisions old R releases","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()  available_r"},{"path":"https://b-rodrigues.github.io/rix/reference/available_r.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"List available R versions from Nixpkgs — available_r","text":"data frame 39 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/available_r.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"List available R versions from Nixpkgs — available_r","text":"Nix Package Version, Marcelo Lazaroni","code":""},{"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\"  \"4.3.2\"  \"4.3.3\"  \"4.4.0\""},{"path":"https://b-rodrigues.github.io/rix/reference/ga_cachix.html","id":null,"dir":"Reference","previous_headings":"","what":"ga_cachix Build an environment on Github Actions and cache it on Cachix — ga_cachix","title":"ga_cachix Build an environment on Github Actions and cache it on Cachix — ga_cachix","text":"ga_cachix Build environment Github Actions cache Cachix","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/ga_cachix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ga_cachix Build an environment on Github Actions and cache it on Cachix — ga_cachix","text":"","code":"ga_cachix(cache_name, path_default)"},{"path":"https://b-rodrigues.github.io/rix/reference/ga_cachix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"ga_cachix Build an environment on Github Actions and cache it on Cachix — ga_cachix","text":"cache_name String, name cache. path_default String, relative path (root directory project) default.nix build.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/ga_cachix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"ga_cachix Build an environment on Github Actions and cache it on Cachix — ga_cachix","text":"Nothing, copies file directory.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/ga_cachix.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"ga_cachix Build an environment on Github Actions and cache it on Cachix — ga_cachix","text":"function puts .yaml file inside .github/workflows/ folders root project. workflow file use projects default.nix file generate development environment Github Actions cache created binaries Cachix. Create free account Cachix use action. Refer vignette(\"z-binary_cache\") detailed instructions. Make sure give read write permissions Github Actions bot.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/ga_cachix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"ga_cachix Build an environment on Github Actions and cache it on Cachix — ga_cachix","text":"","code":"if (FALSE) { # \\dontrun{ ga_cachix(\"my-cachix\", path_default = \"default.nix\") } # }"},{"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 = \".\", message_type = c(\"simple\", \"quiet\", \"verbose\"))"},{"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. message_type Character vector messaging type, Either \"simple\" (default), \"quiet\" messaging, \"verbose\".","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) { # \\dontrun{ nix_build() } # }"},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate a Nix expression that builds a reproducible development environment — rix","title":"Generate a Nix expression that builds a reproducible development environment — rix","text":"Generate 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":"Generate 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,   local_r_pkgs = NULL,   tex_pkgs = NULL,   ide = c(\"other\", \"code\", \"radian\", \"rstudio\", \"rserver\"),   project_path = \".\",   overwrite = FALSE,   print = FALSE,   message_type = \"simple\",   shell_hook = NULL )"},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate 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. older versions R, nix-build might fail error stating 'derivation meant built'. case, simply drop shell nix-shell instead building first. also possible provide either \"bleeding_edge\" \"frozen_edge\" need environment bleeding edge packages. Read \"Details\" section . 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. local_r_pkgs List. list local packages install. packages need .tar.gz .zip formats must folder generated \"default.nix\" file. 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\" \"rserver\" server version. Use \"code\" Visual Studio Code. can also use \"radian\", interactive REPL. 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\". folder exist, created. overwrite Logical, defaults FALSE. TRUE, overwrite default.nix file specified path. print Logical, defaults FALSE. TRUE, print default.nix console. message_type Character. Message type, defaults \"simple\", gives minimal sufficient feedback. values currently \"quiet, generates files without message, \"verbose\", displays messages. shell_hook Character length 1, defaults NULL. Commands added shellHook variable executed Nix shell starts. default, using nix-shell default.nix start specific program, possibly flags (separated space), /shell actions. can example use shell_hook = R, want directly enter declared Nix R session dropping Nix shell.","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate a Nix expression that builds a reproducible development environment — rix","text":"Nothing, function side-effect writing two files: default.nix .Rprofile working directory. default.nix contains Nix expression build reproducible environment using Nix package manager, .Rprofile ensures running R session Nix environment access local libraries, install packages using install.packages().","code":""},{"path":"https://b-rodrigues.github.io/rix/reference/rix.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Generate a Nix expression that builds a reproducible development environment — rix","text":"function write default.nix .Rprofile 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. possible use environments built Nix interactively, either terminal, using interface RStudio. want use RStudio, set ide argument \"rstudio\". Please aware RStudio available macOS Nix. , may want use another editor macOS. use Visual Studio Code (Codium), set ide argument \"code\", add {languageserver} R package list R packages installed Nix environment. can use version Visual Studio Code Codium already use, also install using Nix (adding \"vscode\" \"vscodium\" list system_pkgs). non-interactive use, use environment command line, another editor (Emacs Vim), set ide argument \"\". recommend reading vignette(\"e-interactive-use\") details. Packages install Github must provided list 4 elements: \"package_name\", \"repo_url\" \"commit\". argument can also list lists 3 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. Note installing packages Git old versions using \"@\" notation local packages, leverage Nix's capabilities dependency solving. , might trouble installing packages. case, open issue {rix}'s Github repository. 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. possible use \"bleeding_edge\" \"frozen_edge\" value r_ver argument. create environment latest R packages. \"bleeding_edge\" means every time build environment, packages get updated. especially useful environments need constantly updated, example developing package. contrast, \"frozen_edge\" create environment remain stable build time. create default.nix file using \"bleeding_edge\", time build using nix-build environment --date. \"frozen_edge\" environment --date date default.nix generated, subsequent call nix-build result environment. highly recommend read vignette titled \"z - Advanced topic: Understanding rPackages set release cycle using bleeding edge packages\".","code":""},{"path":[]},{"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 setup via Nix. — rix_init","title":"Initiate and maintain an isolated, project-specific, and runtime-pure R setup 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 setup via Nix. — rix_init","text":"","code":"rix_init(   project_path = \".\",   rprofile_action = c(\"create_missing\", \"create_backup\", \"overwrite\", \"append\"),   message_type = c(\"simple\", \"quiet\", \"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 setup 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) - action set using rix() - ; \"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 \"quiet, writes .Rprofile without message, \"verbose\", displays mechanisms implemented achieve fully controlled R project environments Nix.","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 setup 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 setup via Nix. — rix_init","text":"Enhancement computational reproducibility Nix-R environments: primary goal rix::rix_init() enhance computational reproducibility Nix-R environments runtime. Concretely, already system user library R packages (R installed usual means operating system), using rix::rix_init() prevent Nix-R environments load packages user library cause issues. 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(). rix::rix_init() called automatically rix::rix() generating default.nix file, called rix::rix() add .Rprofile none exists. case custom .Rprofile wish keep using, also want benefit rix_init() offers, manually call set rprofile_action \"append\".","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 setup via Nix. — rix_init","text":"","code":"if (FALSE) { # \\dontrun{ # create an isolated, runtime-pure R setup via Nix project_path <- \"./sub_shell\" if (!dir.exists(project_path)) dir.create(project_path) rix_init(   project_path = project_path,   rprofile_action = \"create_missing\",   message_type = c(\"simple\") ) } # }"},{"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 directory.","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) { # \\dontrun{ 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\"),   project_path = \".\",   message_type = c(\"simple\", \"quiet\", \"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. 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. message_type String detailed output . Currently, either \"simple\" (default), \"quiet \"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. rix_init() run automatically 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) { # \\dontrun{ # 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\", 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 = function() get_sample(seed = 1234, n = 5),   program = \"R\",   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":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-091-2024-07-30","dir":"Changelog","previous_headings":"","what":"rix 0.9.1 (2024-07-30)","title":"rix 0.9.1 (2024-07-30)","text":"Fix directory creation with_nix(), using recursive = TRUE dir.create()","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"user-facing-changes-0-9-0","dir":"Changelog","previous_headings":"","what":"User-facing changes","title":"rix 0.9.0 (2024-07-22)","text":"rix::rix(): necessary anymore provide branch_name list element R packages GitHub git_pkgs.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"bug-fixes-0-9-0","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"rix 0.9.0 (2024-07-22)","text":"error ide = \"rstudio\" additional R packages chosen. situation, rStudioWrapper approach work resulting Nix expression build. returned error states either add rstudio system_pkgs, add R packages r_pkgs git_pkgs.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"chores-0-9-0","dir":"Changelog","previous_headings":"","what":"Chores","title":"rix 0.9.0 (2024-07-22)","text":"Github Actions: now use rhub2 checking package rix::rix() docs: explain options(rix.sri_hash). Source code now follows tidyverse style guide thanks styler Readme: added section explain comparing {rix} Nix package managers","code":""},{"path":[]},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"new-features-0-8-0","dir":"Changelog","previous_headings":"","what":"New features","title":"rix 0.8.0 (2024-07-02)","text":"Added possibility install local archives via local_r_pkgs argument. Compute hash git CRAN archive packages locally nix installed. also new options(rix.sri_hash=\"API_server\"), online hashing via http://git2nixsha.dev can requested even Nix installed locally.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"user-facing-changes-0-8-0","dir":"Changelog","previous_headings":"","what":"User-facing changes","title":"rix 0.8.0 (2024-07-02)","text":"Now runs rix_init() ensure runtime purity via .Rprofile. exclude system’s user library .libPaths(), search path contain path per package Nix store. New message_type option control signalling done. nix_build(), with_nix(): stabilize API; get rid exec_mode core functions. cases, “non-blocking” system calls run system commands like nix-shell nix-build. rix_init(), nix_build(), with_nix(): gain message_type = \"quiet\", suppresses messages. , messaging standardized via internal helpers called.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"chores-0-8-0","dir":"Changelog","previous_headings":"","what":"Chores","title":"rix 0.8.0 (2024-07-02)","text":"Fine-tune formatting *.nix files generated low-level requests {curl} -> remove {httr} dependency ROpenSci review: complete documentation internal functions remove nix_file interface with_nix() document","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-071-2024-05-24","dir":"Changelog","previous_headings":"","what":"rix 0.7.1 (2024-05-24)","title":"rix 0.7.1 (2024-05-24)","text":"Better messages comments top generated default.nix files.","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-070-2024-05-21","dir":"Changelog","previous_headings":"","what":"rix 0.7.0 (2024-05-21)","title":"rix 0.7.0 (2024-05-21)","text":"Added possibility create “bleeding_edge” “frozen_edge” environments Added possibility use radian environment’s console (courtesy kupac) RStudio server Added ga_cachix(), function create GA workflow file builds pushes environment Cachix cache","code":""},{"path":"https://b-rodrigues.github.io/rix/news/index.html","id":"rix-0609000-2024-05-05","dir":"Changelog","previous_headings":"","what":"rix 0.6.0.9000 (2024-05-05)","title":"rix 0.6.0.9000 (2024-05-05)","text":"with_nix(): use --vanilla respect custom code startup via .Rprofile nix_build() with_nix(): improvements. Remove nix-build artefact file using Sys.() checking availability. with_nix(): clean itermediary output artefacts (files) exit Patch rix() shell_hook = NULL default, Nix-R wrappers nix_build() with_nix(); update testfiles with_nix(): try sessionInfo(); fails R Nixpkgs darwin remove R_LIBS_USER .libPaths() covr test environment nix_build() & with_nix(): fix segmentation fault adjusting LD_LIBRARY_PATH temporarily nix_build(): consistently separate cmd args nix-build system command nix_build(): another guardrail run-time purity Nixpkgs R implement nix_file specify specific .nix file Make nix_shell() with_nix() compatible RStudio macOS, R session (yet) started shell. Now /nix/var/nix/profiles/default/bin added PATH variable nix_shell() with_nix() called RStudio version system (Nix package). Add rix::init() initiate maintain isolated, project-specific pure R setup via Nix update glibcLocales patch -with_nix() needs patch R <= 4.2.0; glibcLocalesUtf8 -> gibcLocales Implement with_nix() valuate function R shell command via nix-shell environment 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":"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":""}]