Skip to content

Instantly share code, notes, and snippets.

@WolfangAukang
Created February 11, 2022 21:20
Show Gist options
  • Select an option

  • Save WolfangAukang/fac08101a9798a3700985326f3af5cb3 to your computer and use it in GitHub Desktop.

Select an option

Save WolfangAukang/fac08101a9798a3700985326f3af5cb3 to your computer and use it in GitHub Desktop.
Using custom kernels in Jupyter through Nix

Using custom kernels in Jupyter through Nix

Notes

  • Verify the kernel you are using has a ${path}/share/jupyter path, so it can be recognized by the command jupyter kernelspec list
  • Run nix-shell, and if everything is successful, check if the kernels are listed
{ pkgs ? import <nixpkgs> {}, pythonPackages ? pkgs.python39Packages }:
let
kernels = with pythonPackages; [
ansible-kernel
ilua
];
in pkgs.mkShell {
buildInputs = with pythonPackages; [
jupyterlab
numpy
scipy
matplotlib
] ++ kernels;
shellHook = ''
# kernels
export JUPYTER_PATH="${pkgs.lib.concatMapStringsSep ":" (p: "${p}/share/jupyter/") kernels}"
echo Lets do some python
alias start="jupyter lab"
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment