Created
December 28, 2019 14:57
-
-
Save idontgetoutmuch/2760ce599037c1bc9013f21929f43aeb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
pkgs = import <nixpkgs> {}; | |
in | |
let | |
my-R-packages = with pkgs.rPackages; [ rstan zoo ggplot2 dplyr coda ]; | |
R-with-my-packages = pkgs.rWrapper.override{ packages = with pkgs.rPackages; my-R-packages ++ [ JuniperKernel ]; }; | |
jupyter-R-kernel = pkgs.stdenv.mkDerivation { | |
name = "jupyter-R-kernel"; | |
buildInputs = [ pkgs.python37Packages.notebook R-with-my-packages pkgs.which ]; | |
unpackPhase = ":"; | |
installPhase = '' | |
export HOME=$TMP | |
echo $JUPYTER_PATH | |
${R-with-my-packages}/bin/R --slave -e "JuniperKernel::listKernels()" | |
${R-with-my-packages}/bin/R --slave -e "JuniperKernel::installJuniper(prefix='$out')" | |
''; | |
}; | |
in | |
pkgs.mkShell rec { | |
name = "jupyter-with-R-kernel"; | |
buildInputs = [ pkgs.libintl jupyter-R-kernel pkgs.python37Packages.jupyter ]; | |
shellHook = '' | |
export JUPYTER_PATH=${jupyter-R-kernel}/share/jupyter | |
# see https://github.com/NixOS/nixpkgs/issues/38733 | |
${R-with-my-packages}/bin/R --slave -e "system2('jupyter', 'notebook')" | |
''; | |
} |
Author
idontgetoutmuch
commented
Dec 28, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment