Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. with import <nixpkgs> {};
  2. let
  3. # Change these if you need extra R or Python packages.
  4.  
  5. my-R-packages = with rPackages; [ cmaes ggplot2 dplyr xts ];
  6. my-python-packages = [ python37Packages.numpy python37Packages.scikits-odes];
  7.  
  8. R-with-my-packages = rWrapper.override{ packages = with rPackages; my-R-packages ++ [ JuniperKernel ]; };
  9. jupyter-R-kernel = stdenv.mkDerivation {
  10. name = "jupyter-R-kernel";
  11. buildInputs = [ python37Packages.jupyter python37Packages.notebook R-with-my-packages which ];
  12. unpackPhase = ":";
  13. installPhase = ''
  14. export HOME=$TMP
  15. echo $JUPYTER_PATH
  16. ${R-with-my-packages}/bin/R --slave -e "JuniperKernel::listKernels()"
  17. ${R-with-my-packages}/bin/R --slave -e "JuniperKernel::installJuniper(prefix='$out')"
  18. '';
  19. };
  20. in
  21. mkShell rec {
  22. name = "jupyter-with-R-kernel";
  23. buildInputs = [ jupyter-R-kernel python37Packages.jupyter ] ++ my-python-packages;
  24. shellHook = ''
  25. export JUPYTER_PATH=${jupyter-R-kernel}/share/jupyter
  26. # see https://github.com/NixOS/nixpkgs/issues/38733
  27. ${R-with-my-packages}/bin/R --slave -e "system2('jupyter', 'notebook')"
  28. '';
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement