Add JupyterHub

TODO: Add documentation about customizing and making requests for JupyterHub
master
David Crompton 2024-01-16 11:01:22 -05:00
parent 14e2dca865
commit b887e7036d
2 changed files with 63 additions and 0 deletions

View File

@ -8,5 +8,7 @@
./servers/guac.nix
# Overleaf (Collaborative LaTeX)
./servers/overleaf.nix
# Basic remote editting in jupyer notebooks
./servers/jupyterhub.nix
];
}

View File

@ -0,0 +1,61 @@
{ config, pkgs, lib, ... }: {
services.jupyterhub = {
enable = true;
port = 6501;
# https://github.com/jupyterhub/systemdspawner
# Configuration options defined ^
extraConfig = ''
c.SystemdSpawner.mem_limit = '2G'
c.SystemdSpawner.cpu_limit = 1.0
'';
kernels = {
python = {
python3 = let
env = (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [
# Necessary for use as a kernel
ipykernel
# Common Python Libraries
numpy
scipy
scikit-learn
pandas
matplotlib
seaborn
# Neural Data Processing Libraries
mne-python
nibabel
neo
# Neurosimulators
neuronpy
nest
brian2
]));
in {
displayName = "Python 3 for Computational Neuroscience";
argv = [
"${env.interpreter}"
"-m"
"ipykernel_launcher"
"-f"
"{connection_file}"
];
language = "python";
logo32 = "${env}/${env.sitePackages}/ipykernel/resources/logo-32x32.png";
logo64 = "${env}/${env.sitePackages}/ipykernel/resources/logo-64x64.png";
};
};
};
};
services.caddy.virtualHosts = {
"jupyter.ws.kcnhub.com" = {
extraConfig = ''
reverse_proxy 127.0.0.1:${toString config.services.jupyterhub.port}
'';
};
};
}