git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #19533 from siddharthist/r-modules/readme-nix-shell

r-modules: add more nix-shell documentation

commitfe518a733fbd92fc4973e0580bca29838fe0b69e authorJörg Thalheim <joerg@higgsboson.tk> dateFri 14 Oct 2016, 09:09 (10 years ago) parent9615afa2b300c9
1 file changed+24
pkgs/development/r-modules/README.md+24
pkgs/development/r-modules/README.md+24
@@ -29,6 +29,30 @@ profile. The set of available libraries can be discovered by running the
2929command `nix-env -f "<nixpkgs>" -qaP -A rPackages`. The first column from that
3030output is the name that has to be passed to rWrapper in the code snipped above.
3131
32+However, if you'd like to add a file to your project source to make the
33+environment available for other contributors, you can create a `default.nix`
34+file like so:
35+```nix
36+let
37+ pkgs = import <nixpkgs> {};
38+ stdenv = pkgs.stdenv;
39+in with pkgs; {
40+ myProject = stdenv.mkDerivation {
41+ name = "myProject";
42+ version = "1";
43+ src = if pkgs.lib.inNixShell then null else nix;
44+
45+ buildInputs = with rPackages; [
46+ R
47+ ggplot2
48+ knitr
49+ ];
50+ };
51+}
52+```
53+and then run `nix-shell .` to be dropped into a shell with those packages
54+available.
55+
3256## Updating the package set
3357
3458```bash