Skip to content

Instantly share code, notes, and snippets.

@j-keck
Last active January 27, 2022 13:47
Show Gist options
  • Save j-keck/09737f7ee9b63ab8ea99d1e7eba79676 to your computer and use it in GitHub Desktop.
Save j-keck/09737f7ee9b63ab8ea99d1e7eba79676 to your computer and use it in GitHub Desktop.
nixos - ipython with octave kernel
with import <nixpkgs> {}; {
pyEnv = stdenv.mkDerivation {
name = "octave-kernel";
buildInputs = [ python27Packages.pip python27Packages.virtualenv python27Packages.jupyter python27Packages.notebook octave gnuplot];
shellHook = ''
if [ ! -d venv ] ; then
virtualenv venv
./venv/bin/pip install octave_kernel
./venv/bin/python -m octave_kernel.install
fi
jupyter notebook --ip='*' --no-browser
'';
};
}
with import <nixpkgs> {}; {
pyEnv = stdenv.mkDerivation {
name = "octave-kernel";
src = fetchgit {
url = "git://github.com/Calysto/octave_kernel.git";
rev = "8a796d3f9ac468ddf490fd2669e38ff37f3056dc";
# per [j@nixos32:~]$ nix-prefetch-git https://github.com/Calysto/octave_kernel.git
sha256 = "e660a2ae3bc833cc77a5ab091b6219c7d8e088e75c3624a30297e2a9dc79f0b6";
};
buildInputs = [ python27Packages.ipython python27Packages.notebook octave];
shellHook = ''
export PYTHONPATH=$src:$PYTHONPATH
if ! (ipython kernelspec list | grep -q octave) ; then
echo "install octave kernel"
python -m octave_kernel.install
fi
ipython notebook --ip='*' --no-browser &
'';
};
}
ipython kernelspec list
Available kernels:
python2 /nix/store/zs3909p2q0634hcn245ghlkwjlkvnzpq-python2.7-ipykernel-4.3.0/lib/python2.7/site-packages/ipykernel/resources
octave /home/j/.local/share/jupyter/kernels/octave
/nix/store/g1i1wwbjf81qn6758wnxm126cipnqf4x-python-2.7.11/bin/python: No module named octave_kernel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment