Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 16.09 55 lines 1.5 kB view raw view rendered
1R packages 2========== 3 4## Installation 5 6Define an environment for R that contains all the libraries that you'd like to 7use by adding the following snippet to your $HOME/.nixpkgs/config.nix file: 8 9```nix 10{ 11 packageOverrides = super: let self = super.pkgs; in 12 { 13 14 rEnv = super.rWrapper.override { 15 packages = with self.rPackages; [ 16 devtools 17 ggplot2 18 reshape2 19 yaml 20 optparse 21 ]; 22 }; 23 }; 24} 25``` 26 27Then you can use `nix-env -f "<nixpkgs>" -iA rEnv` to install it into your user 28profile. The set of available libraries can be discovered by running the 29command `nix-env -f "<nixpkgs>" -qaP -A rPackages`. The first column from that 30output is the name that has to be passed to rWrapper in the code snipped above. 31 32## Updating the package set 33 34```bash 35Rscript generate-r-packages.R cran > cran-packages.nix.new 36mv cran-packages.nix.new cran-packages.nix 37 38Rscript generate-r-packages.R bioc > bioc-packages.nix.new 39mv bioc-packages.nix.new bioc-packages.nix 40 41Rscript generate-r-packages.R irkernel > irkernel-packages.nix.new 42mv irkernel-packages.nix.new irkernel-packages.nix 43``` 44 45`generate-r-packages.R <repo>` reads `<repo>-packages.nix`, therefor the renaming. 46 47 48## Testing if the Nix-expression could be evaluated 49 50```bash 51nix-build test-evaluation.nix --dry-run 52``` 53 54If this exits fine, the expression is ok. If not, you have to edit `default.nix` 55