From b5de57fd01751ea173854a7295952df97d3c5564 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 5 Nov 2022 22:49:54 +0100 Subject: [PATCH] Add config for jupyter --- hosts/tsuki/configuration.nix | 1 + hosts/tsuki/services/jupyter.nix | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 hosts/tsuki/services/jupyter.nix diff --git a/hosts/tsuki/configuration.nix b/hosts/tsuki/configuration.nix index b6debcd..9b7fca9 100644 --- a/hosts/tsuki/configuration.nix +++ b/hosts/tsuki/configuration.nix @@ -10,6 +10,7 @@ ./services/grafana.nix ./services/hydra.nix # ./services/jitsi.nix + ./services/jupyter.nix # ./services/keycloak.nix # ./services/libvirt.nix ./services/matrix diff --git a/hosts/tsuki/services/jupyter.nix b/hosts/tsuki/services/jupyter.nix new file mode 100644 index 0000000..6abf2f6 --- /dev/null +++ b/hosts/tsuki/services/jupyter.nix @@ -0,0 +1,35 @@ +{ pkgs, secrets, ... }: +{ + users.users.jupyter = { + group = "jupyter"; + }; + + services.jupyter = { + enable = true; + group = "jupyter"; + ip = "0.0.0.0"; + port = secrets.ports.jupyterhub; + password = secrets.keys.hashed.jupyter; + kernels = { + pythonDS = let + env = (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [ + numpy + matplotlib + ipykernel + ])); + in { + displayName = "Python for data science"; + 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"; + }; + }; + }; +}