tweag / HaskellR

The full power of R in Haskell.
https://tweag.github.io/HaskellR
Other
585 stars 47 forks source link

How to add R packages to nix install of HaskellR? #287

Closed skeydan closed 7 years ago

skeydan commented 7 years ago

Hi,

I'm new to nix (but have to use it to get HaskellR running, as I'm on Fedora and running into the linker problem described in the FAQ), and I wonder how to add R packages (ggplot2, etc...) to the installation?

Thank you very much in advance, Sigrid

qnikst commented 7 years ago

Hi.

The simplest way in the nix-based setup that I've found so far is modifying shell.nix locally.

Example:

diff --git a/shell.nix b/shell.nix
index 3c6f56d..58d3e3a 100644
--- a/shell.nix
+++ b/shell.nix
@@ -18,6 +18,8 @@ haskell.lib.buildStackProject {
       python35Packages.ipython
       python35Packages.jupyter_client
       python35Packages.notebook
+      rPackages.ggplot2
+      rPackages.rjson
       R
       zeromq
       zlib

You can use other packages in the same way. This way they will be accessible using H, inline-r, of if you build standalone changes.

Would it work for you?

skeydan commented 7 years ago

This works like a charm, thank you so much!