nixpkgs/pkgs/development/r-modules
2016-09-27 17:47:16 +02:00
..
patches
bioc-annotation-packages.nix
bioc-experiment-packages.nix
bioc-packages.nix
cran-packages.nix
default.nix r-modules: edgeR is broken due to broken url 2016-09-27 17:47:16 +02:00
generate-r-packages.R
generate-shell.nix
generic-builder.nix darwin: R: provide gettext and gfortran as buildInputs on Darwin. 2016-07-22 13:31:40 -04:00
irkernel-packages.nix
README.md
test-evaluation.nix
wrapper.nix treewide: Add lots of platforms to packages with no meta 2016-08-02 21:17:44 +03:00

R packages

Installation

Define an environment for R that contains all the libraries that you'd like to use by adding the following snippet to your $HOME/.nixpkgs/config.nix file:

{
    packageOverrides = super: let self = super.pkgs; in
    {

        rEnv = super.rWrapper.override {
            packages = with self.rPackages; [ 
                devtools
                ggplot2
                reshape2
                yaml
                optparse
                ];
        };
    };
}

Then you can use nix-env -f "<nixpkgs>" -iA rEnv to install it into your user profile. The set of available libraries can be discovered by running the command nix-env -f "<nixpkgs>" -qaP -A rPackages. The first column from that output is the name that has to be passed to rWrapper in the code snipped above.

Updating the package set

Rscript generate-r-packages.R cran  > cran-packages.nix.new
mv cran-packages.nix.new cran-packages.nix

Rscript generate-r-packages.R bioc  > bioc-packages.nix.new
mv bioc-packages.nix.new bioc-packages.nix

Rscript generate-r-packages.R irkernel  > irkernel-packages.nix.new
mv irkernel-packages.nix.new irkernel-packages.nix

generate-r-packages.R <repo> reads <repo>-packages.nix, therefor the renaming.

Testing if the Nix-expression could be evaluated

nix-build test-evaluation.nix --dry-run

If this exits fine, the expression is ok. If not, you have to edit default.nix