Created
December 19, 2019 08:48
-
-
Save tbenst/c88da1138628a6be1d5b88d3a9337f2a 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
{ pkgs ? import <nixpkgs> {} | |
# , pythonPackages ? pkgs.python37Packages | |
}: | |
let | |
python37Packages = pkgs.python37Packages; | |
kernels = [ | |
/* pkgs.python3Packages.ansible-kernel */ | |
#pythonPackages.jupyter-c-kernel | |
/* pkgs.gophernotes */ | |
]; | |
additionalExtensions = [ | |
/* "@jupyterlab/toc" | |
"@jupyterlab/fasta-extension" | |
"@jupyterlab/geojson-extension" | |
"@jupyterlab/katex-extension" | |
"@jupyterlab/mathjax3-extension" | |
"@jupyterlab/plotly-extension" | |
"@jupyterlab/vega2-extension" | |
"@jupyterlab/vega3-extension" | |
"@jupyterlab/xkcd-extension" | |
"jupyterlab-drawio" | |
"@jupyterlab/hub-extension" */ | |
"jupyterlab_bokeh" | |
]; | |
additionalPythonPackages = with python37Packages; [ | |
babelfish | |
click | |
dill | |
h5py | |
ipython | |
ipywidgets | |
joblib | |
jupyterlab | |
matplotlib | |
moviepy | |
numpy | |
opencv3 | |
pandas | |
pip2nix | |
pytest | |
pytorch | |
pyyaml | |
requests | |
scikitimage | |
scikitlearn | |
scipy | |
seaborn | |
setuptools | |
# tensorflow | |
# tensorflow-probability | |
tifffile | |
torchvision | |
tqdm | |
# https://nixos.wiki/wiki/Nvidia#CUDA | |
wheel | |
]; | |
cudaReqs = with pkgs; [ | |
autoconf | |
binutils | |
cudatoolkit | |
curl | |
ffmpeg-full | |
freeglut | |
git | |
gitRepo | |
gnumake | |
gnupg | |
gperf | |
libGL | |
libGLU | |
linuxPackages.nvidia_x11 | |
m4 | |
ncurses5 | |
nodejs-12_x | |
procps | |
stdenv.cc | |
unzip | |
utillinux | |
xorg.libX11 | |
xorg.libXext | |
xorg.libXi | |
xorg.libXmu | |
xorg.libXrandr | |
xorg.libXv | |
zlib | |
]; | |
jupyterPort = pkgs.config.jupyterPort; | |
in | |
pkgs.mkShell rec { | |
buildInputs = [ | |
### Base Packages | |
python37Packages.jupyterlab pkgs.nodejs | |
# moviepy | |
pkgs.ffmpeg-full | |
### Extensions | |
python37Packages.ipywidgets | |
#pythonPackages.ipydatawidgets | |
#pythonPackages.ipywebrtc | |
#pythonPackages.pythreejs | |
#pythonPackages.ipyvolume | |
#pythonPackages.jupyterlab-git | |
#pythonPackages.jupyterlab-latex | |
#pythonPackages.ipyleaflet | |
#pythonPackages.ipympl | |
] ++ kernels ++ cudaReqs ++ additionalPythonPackages; | |
shellHook = '' | |
TEMPDIR=$(mktemp -d -p /tmp) | |
mkdir -p $TEMPDIR | |
cp -r ${python37Packages.jupyterlab}/share/jupyter/lab/* $TEMPDIR | |
chmod -R 755 $TEMPDIR | |
echo "$TEMPDIR is the app directory" | |
# kernels | |
export JUPYTER_PATH="${pkgs.lib.concatMapStringsSep ":" (p: "${p}/share/jupyter/") kernels}" | |
# labextensions | |
${pkgs.stdenv.lib.concatMapStrings | |
(s: "jupyter labextension install --no-build --app-dir=$TEMPDIR ${s}; ") | |
(pkgs.lib.unique | |
((pkgs.lib.concatMap | |
(d: pkgs.lib.attrByPath ["passthru" "jupyterlabExtensions"] [] d) | |
buildInputs) ++ additionalExtensions)) } | |
jupyter lab build --app-dir=$TEMPDIR | |
# Cuda | |
export CUDA_PATH=${pkgs.cudatoolkit} | |
export EXTRA_LDFLAGS="-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib" | |
/* export LD_LIBRARY_PATH=${pkgs.linuxPackages.nvidia_x11}/lib:${pkgs.ncurses5}/lib */ | |
export EXTRA_CCFLAGS="-I/usr/include" | |
# start jupyterlab | |
cd ~/Notebooks | |
jupyter lab --app-dir=$TEMPDIR --port=${jupyterPort} --no-browser | |
''; | |
} |
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
{ pkgs ? import <nixpkgs> {} }: | |
let | |
jupyter = import (builtins.fetchGit { | |
url = https://github.com/tweag/jupyterWith; | |
rev = ""; | |
}) {}; | |
iPython = jupyter.kernels.iPythonWith { | |
name = "python"; | |
packages = p: with p; [ | |
# manifold-learning | |
babelfish | |
click | |
dill | |
h5py | |
ipython | |
ipywidgets | |
joblib | |
jupyterlab | |
matplotlib | |
moviepy | |
numpy | |
opencv3 | |
pandas | |
pip2nix | |
pytest | |
pytorch | |
pyyaml | |
requests | |
scikitimage | |
scikitlearn | |
scipy | |
seaborn | |
setuptools | |
tensorflow | |
tensorflow-probability | |
tifffile | |
torchvision | |
tqdm | |
wheel | |
]; | |
}; | |
iPython2 = jupyter.kernels.iPythonWith { | |
name = "python2"; | |
packages = p: with p; pkgs.config.myPythonPkgs; | |
}; | |
iHaskell = jupyter.kernels.iHaskellWith { | |
name = "haskell"; | |
packages = p: with p; [ hvega formatting ]; | |
}; | |
cudaReqs = with pkgs; [ | |
]; | |
jupyterEnvironment = | |
jupyter.jupyterlabWith { | |
kernels = [ iPython iHaskell ]; | |
directory = jupyter.mkDirectoryWith { | |
extensions = [ | |
"jupyterlab-ihaskell" | |
"jupyterlab_bokeh" | |
]; | |
}; | |
extraPackages = p: with p; [ | |
autoconf | |
binutils | |
cudatoolkit | |
curl | |
ffmpeg-full | |
freeglut | |
git | |
gitRepo | |
gnumake | |
gnupg | |
gperf | |
libGL | |
libGLU | |
linuxPackages.nvidia_x11 | |
m4 | |
ncurses5 | |
nodejs-12_x | |
procps | |
stdenv.cc | |
unzip | |
utillinux | |
xorg.libX11 | |
xorg.libXext | |
xorg.libXi | |
xorg.libXmu | |
xorg.libXrandr | |
xorg.libXv | |
zlib | |
]; | |
}; | |
in | |
jupyterEnvironment.env |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment