87 lines
2.5 KiB
Nix
87 lines
2.5 KiB
Nix
{ 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
|
|
c.SystemdSpawner.extra_paths = ['${pkgs.buildEnv {
|
|
name = "jupyterhub-system-spawner-env";
|
|
paths = with pkgs; [
|
|
gcc
|
|
];
|
|
}}/bin']
|
|
'';
|
|
# Extra Paths used to add gcc et al for packages like Brian2
|
|
# https://github.com/jupyterhub/systemdspawner#extra_paths
|
|
|
|
kernels = {
|
|
python3 = let
|
|
env = (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [
|
|
# Necessary for use as a kernel
|
|
ipykernel
|
|
ipdb
|
|
# Interactive widgets
|
|
ipywidgets
|
|
# Show images/media
|
|
mediapy
|
|
# Progress bars etc. for in Jupyter/IPython
|
|
halo
|
|
|
|
# Common Python Libraries
|
|
numpy
|
|
scipy
|
|
scikit-learn
|
|
pandas
|
|
# Tables displayed in Jupyter: like Pandas Dataframes
|
|
ipytablewidgets
|
|
matplotlib
|
|
ipympl
|
|
matplotlib-inline
|
|
seaborn
|
|
|
|
# Neural Data Processing Libraries
|
|
# Temporarily broken?: https://github.com/NixOS/nixpkgs/issues/259812
|
|
# mne-python
|
|
nibabel
|
|
# View niftis!
|
|
ipyniivue
|
|
neo
|
|
|
|
# Neurosimulators
|
|
neuronpy
|
|
# nest with MPI is incompatible with Jupyter:
|
|
# https://www.nest-simulator.org/pynest-api/_modules/nest.html
|
|
# see pynestkernel comments about their workaround
|
|
(nest.override {
|
|
withMpi = false;
|
|
})
|
|
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}
|
|
'';
|
|
};
|
|
};
|
|
}
|