diff --git a/11-nix.qmd b/11-nix.qmd index 8c4881d..f7d808e 100644 --- a/11-nix.qmd +++ b/11-nix.qmd @@ -6,4 +6,31 @@ knitr::include_graphics("img/nix.png") ``` -Nix is a package manager... +## The Nix package manager + +Nix is a package manager that can be used to build completely reproducible development environments. These environments can be used +for interactive data analysis or running pipelines in a CI/CD environment. + +If you’re familiar with the Ubuntu Linux distribution, you likely have used `apt-get` to install software. On macOS, you may have used +`homebrew` for similar purposes. Nix functions in a similar way, but has many advantages over classic package managers. The main advantage of +Nix, at least for our purposes, is that its repository of software is huge. As of writing, it contains more than 80.000 packages, and the +entirety of CRAN and Bioconductor is available through Nix’s repositories. This means that using Nix, it is possible to install not only R, +but also all the packages required for your project. The obvious question is why use Nix instead of simply installing R and R packages as usual. +The answer is that Nix makes sure to install every dependency of any package, up to required system libraries. For example, the `{xlsx}` +package requires the Java programming language to be installed on your computer to successfully install. This can be difficult to achieve, +and `{xlsx}` bullied many R developers throughout the years (especially those using a Linux distribution, `sudo R CMD javareconf` still +plagues my nightmares). But with Nix, it suffices to declare that we want the `{xlsx}` package for our project, and Nix figures out automatically +that Java is required and installs and configures it. It all just happens without any required intervention from the user. The second advantage +of Nix is that it is possible to pin a certain revision of the Nix packages’ repository (called nixpkgs) for our project. Pinning a revision +ensures that every package that Nix installs will always be at exactly the same versions, regardless of when in the future the packages get installed. + +With Nix, it is essentially possible to replace {renv} and Docker combined. If you need other tools or languages like Python or Julia, +this can also be done easily. Nix is available for Linux, macOS and Windows (via WSL2). + +## The Nix programming language + +## The Nix package repository + +## The NixOS operating system + +## The {rix} package