WS-KCNHUB/machines/kcnhub/servers/jupyterhub.nix

62 lines
1.5 KiB
Nix
Raw Normal View History

{ 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}
'';
};
};
}