Skip to content

Commit

Permalink
Update 11-nix.qmd
Browse files Browse the repository at this point in the history
  • Loading branch information
b-rodrigues authored Nov 20, 2023
1 parent 5a49354 commit 943817a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions 11-nix.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,19 @@ You can now *drop* into a shell with the specified packages using `nix-shell`.

## Running a pipeline with Nix

Once you’ve built and environment, and "dropped" into it, it’s possible to run R by simply typing `R` in the console. If instead you’ve installed an IDE, you can start
is as well by typing the IDE name’s. You can then work interactively with your data. But it is also possible to run a command from that environment. For instance,
if you have a `{targets}` pipeline that you wish to run in an environment built with Nix, you could run the following command (inside the folder containing the
`default.nix` file):

```
nix-shell default.nix --run "Rscript -e 'targets::tar_make()'"
```

This will run the pipeline and build the output. If the output is a rendered Quarto document for instance, you will then see the document appear in the specified output folder.

## CI/CD with Nix

It is also possible to run a `{targets}` pipeline on Github Actions quite easily. Run `rix::tar_nix_ga()` to add the file `.github/workflows/run-pipeline.yaml` to your project.
Now, each time you push changes to your Github repository, the pipeline will be executed. Don’t forget to give read and write rights to the Github Actions bot. You will find
the outputs of the pipeline in the `targets-run` branch of your repository.

0 comments on commit 943817a

Please sign in to comment.