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 Oct 31, 2023
1 parent c3c0a6b commit 8ba76d3
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion 11-nix.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,31 @@ knitr::include_graphics("img/nix.png")
```
</div>

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

0 comments on commit 8ba76d3

Please sign in to comment.