/nix_r_dev_shell

A Nix/NixOS R development environment.

Primary LanguageNixGNU General Public License v3.0GPL-3.0

An R development environment for Nix

Overview

This repo provides the code needed to run a dedicated R development environment in Nix/NixOS.

Quickstart

The simplest way to run this is use nix develop:

	nix develop github:PhDyellow/nix_r_dev_shell#devShells."x86_64-linux".r-shell

Making the shell more reproducible

For reproducibility, specify the git commit hash:

	nix develop github:PhDyellow/nix_r_dev_shell/e14ac6840c7cb813b3c086e7526435aef613f050#devShells."x86_64-linux".r-shell

Preventing the shell software from being garbage-collected

For pinning so nix store gc doesn’t delete all the software, either use direnv, or nix build.

For direnv:

  1. Install direnv on your system
  2. add a file named .envrc in a directory where this R shell will be used with the following contents
    use flake github:PhDyellow/nix_r_dev_shell/e14ac6840c7cb813b3c086e7526435aef613f050#r-shell
        
  3. cd to the folder and type direnv allow
    • Once it is done building, R will be available to any shell that is inside the folder, and nix store gc will not delete the R environment

For nix build, go to a folder where you can leave a symlink, probably your home directory, and run:

	nix build  --print-out-paths github:PhDyellow/nix_r_dev_shell/dc0d948b1fd6c49bd4ba4c61e86ce90b19b37e30#devShells.x86_64-linux.r-shell

Ensure the option --no-link is NOT specified, the link is what stops nix store gc from deleting the R environment.