diff --git a/11-nix.qmd b/11-nix.qmd index 4ab9a2f..999cee7 100644 --- a/11-nix.qmd +++ b/11-nix.qmd @@ -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.