From 8c2d5aba6004e7c28a59d8536240b1b9486f3201 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Tue, 23 Apr 2024 15:57:59 +0100 Subject: [PATCH] Change kernel to be accept a list of kernels List of kernel paths are formatted into JUPYTER_PATH environment variable --- jupyter.nix | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/jupyter.nix b/jupyter.nix index 33f4597..9346594 100644 --- a/jupyter.nix +++ b/jupyter.nix @@ -1,20 +1,25 @@ { - pkgs, - kernel, - python ? pkgs.python3, + mkShellNoCC, + python3, + kernels ? [], + extraPackages ? (ps: []), }: -pkgs.mkShellNoCC { +mkShellNoCC { nativeBuildInputs = [ - (python.withPackages (ps: - with ps; [ - jupyterlab - jupyterlab-git - nbdime - nbconvert - (ps.callPackage ./catppuccin_jupyterlab {}) - ])) + (python3.withPackages (ps: + with ps; + [ + jupyterlab + jupyterlab-git + nbdime + nbconvert + python-lsp-server + (ps.callPackage ./catppuccin_jupyterlab {}) + ] + ++ (extraPackages ps))) ]; - shellHook = '' - export JUPYTER_PATH=${kernel} - ''; + shellHook = with builtins; let + kernelString = foldl' (x: y: ":" + (toString y) + x) "" kernels; + pathString = substring 1 (stringLength kernelString) kernelString; + in "export JUPYTER_PATH=${pathString}"; }