Skip to content

Commit

Permalink
vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Rodrigues committed Jul 30, 2023
1 parent ca24948 commit 0b8602f
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 24 deletions.
4 changes: 2 additions & 2 deletions dev/0-dev_history.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ fusen::inflate(flat_file = "dev/build_envs.Rmd",
# Run but keep eval=FALSE to avoid infinite loop
# Execute in the console directly
fusen::inflate(flat_file = "dev/save_r_nix_revs.Rmd",
vignette_name = "[Dev]-Saving historical revisions",
vignette_name = "Save the Nix Package Versions data",
overwrite = TRUE)
```

```{r}
local({
knitr::knit("vignettes/dev-save_r_nix_revs.Rmd",
knitr::knit("vignettes/save-the-nix-package-versions-data.Rmd",
output = tempfile())
usethis::use_data(r_nix_revs,
overwrite = TRUE)
Expand Down
35 changes: 28 additions & 7 deletions dev/building_envs_with_rix.Rmd
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
title: "Building reproducible development environments with {rix}"
title: "Building reproducible development environments with rix"
output: html_document
editor_options:
chunk_output_type: console
---

The goal of `{rix}` is to provide an easy way to generate `default.nix` files.
These files used by the Nix package manager to build an environment according to
the instructions found in the `default.nix` file. Users can specify which
These files are used by the Nix package manager to build an environment
according to the instructions defined in the file. Users can specify which
version of R, R packages, other needed software, IDE etc should be available
within that environment. Writing such files can be daunting for newcomers, as so
`{rix}` provides a function called `rix()`, which generates such a file.
within that environment. Writing such files can be daunting for newcomers, and
so `{rix}` provides a function called `rix()`, which generates such a file.

Users need to provide the following inputs to `rix()`:

Expand All @@ -22,6 +22,15 @@ Users need to provide the following inputs to `rix()`:
- `path`: the path where to save the `default.nix` file.
- `overwrite`: whether to overwrite the `default.nix` file or not.

## Day-to-day use of {rix}


## Running old projects with {rix}

The example below shows how to create a `default.nix` with instructions to build
an environment with R version 4.2.1, the `{dplyr}` and `{janitor}` packages
and no specific IDE:

```{r}
path_default_nix <- tempdir()
Expand All @@ -31,14 +40,26 @@ rix(r_ver = "4.2.1",
git_pkgs = NULL,
ide = "other",
path = path_default_nix,
overwrite = FALSE)
overwrite = TRUE)
```

```{r}
The file looks like this:

```{r, echo = F}
cat(readLines(paste0(path_default_nix, "/default.nix")), sep = "\n")
```

The first following line is quite important, as it shows which *revision* of
`nixpkgs` is being used for this environment. The *revision* is the commit
hash of that particular release of `nixpkgs`, here: `79b3d4bcae8`. This revision
of `nixpkgs` is the one that shipped version 4.2.1 of R, so the `{dplyr}` and
`{janitor}` packages that will get installed will be the versions available
in that revision as well.




Specifying a package on Github:

```{r}
Expand Down
8 changes: 4 additions & 4 deletions dev/config_fusen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ building_envs_with_rix.Rmd:
state: active
R: []
tests: []
vignettes: vignettes/building_envs_with_rix.Rmd
vignettes: vignettes/building-reproducible-development-environments-with-rix.Rmd
inflate:
flat_file: dev/building_envs_with_rix.Rmd
vignette_name: building_envs_with_rix
vignette_name: Building reproducible development environments with rix
open_vignette: true
check: true
document: true
Expand All @@ -42,10 +42,10 @@ save_r_nix_revs.Rmd:
state: active
R: []
tests: []
vignettes: vignettes/dev-save_r_nix_revs.Rmd
vignettes: vignettes/save-the-nix-package-versions-data.Rmd
inflate:
flat_file: dev/save_r_nix_revs.Rmd
vignette_name: dev-save_r_nix_revs
vignette_name: Save the Nix Package Versions data
open_vignette: true
check: true
document: true
Expand Down
3 changes: 2 additions & 1 deletion dev/config_not_registered.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"type","path","origin"
"vignette","vignettes/dev-build_envs.Rmd","Possibly deprecated file. Please check its link with detected flat source: dev/build_envs.Rmd"
"vignette","vignettes/building-reproducible-development-environments-with-rix.Rmd","Possibly deprecated file. Please check its link with detected flat source: dev/building_envs_with_rix.Rmd"
"vignette","vignettes/save-the-nix-package-versions-data.Rmd","Possibly deprecated file. Please check its link with detected flat source: dev/save_r_nix_revs.Rmd"
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: "building_envs_with_rix"
title: "Building reproducible development environments with rix"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{building_envs_with_rix}
%\VignetteIndexEntry{building-reproducible-development-environments-with-rix}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand All @@ -21,11 +21,11 @@ library(rix)
<!-- WARNING - This vignette is generated by {fusen} from dev/building_envs_with_rix.Rmd: do not edit by hand -->

The goal of `{rix}` is to provide an easy way to generate `default.nix` files.
These files used by the Nix package manager to build an environment according to
the instructions found in the `default.nix` file. Users can specify which
These files are used by the Nix package manager to build an environment
according to the instructions defined in the file. Users can specify which
version of R, R packages, other needed software, IDE etc should be available
within that environment. Writing such files can be daunting for newcomers, as so
`{rix}` provides a function called `rix()`, which generates such a file.
within that environment. Writing such files can be daunting for newcomers, and
so `{rix}` provides a function called `rix()`, which generates such a file.

Users need to provide the following inputs to `rix()`:

Expand All @@ -38,6 +38,15 @@ Users need to provide the following inputs to `rix()`:
- `overwrite`: whether to overwrite the `default.nix` file or not.


## Day-to-day use of {rix}

## Running old projects with {rix}

The example below shows how to create a `default.nix` with instructions to build
an environment with R version 4.2.1, the `{dplyr}` and `{janitor}` packages
and no specific IDE:


```{r}
path_default_nix <- tempdir()
Expand All @@ -47,14 +56,27 @@ rix(r_ver = "4.2.1",
git_pkgs = NULL,
ide = "other",
path = path_default_nix,
overwrite = FALSE)
overwrite = TRUE)
```

```{r}
The file looks like this:


```{r echo = F}
cat(readLines(paste0(path_default_nix, "/default.nix")), sep = "\n")
```

The first following line is quite important, as it shows which *revision* of
`nixpkgs` is being used for this environment. The *revision* is the commit
hash of that particular release of `nixpkgs`, here: `79b3d4bcae8`. This revision
of `nixpkgs` is the one that shipped version 4.2.1 of R, so the `{dplyr}` and
`{janitor}` packages that will get installed will be the versions available
in that revision as well.




Specifying a package on Github:


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: "dev-save_r_nix_revs"
title: "Save the Nix Package Versions data"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{dev-save_r_nix_revs}
%\VignetteIndexEntry{save-the-nix-package-versions-data}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down

0 comments on commit 0b8602f

Please sign in to comment.