Skip to content
Snippets Groups Projects
Unverified Commit 0b2c2f50 authored by Théo Zimmermann's avatar Théo Zimmermann
Browse files

Enable running Jupyter from VS Code.

parent 675efad9
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,9 @@ openrc
*.csv
.direnv
.ipynb_checkpoints
venv
result
snapshots
*.tar.zst
*.zip
*~
\ No newline at end of file
......@@ -4,28 +4,46 @@
};
outputs = { self, nixpkgs }:
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
pythonPackages = pkgs.python311Packages;
venvDir = "venv";
in
{
devShell.x86_64-linux =
pkgs.mkShell {
buildInputs = with pkgs; [
(python311.withPackages
(ps: with ps; [
# We need to make sure that all Python the programs are installed
# with the same version of Python to avoid overriding PYTHONPATH
jupyter
python-openstackclient
python-magnumclient
python-octaviaclient
httpie
requests
]))
buildInputs = with pkgs; with pythonPackages; [
# We need to make sure that all Python the programs are installed
# with the same version of Python to avoid overriding PYTHONPATH
jupyter
python-openstackclient
python-magnumclient
python-octaviaclient
httpie
requests
pwgen
jq
nixpkgs-fmt
];
shellHook = ''
source openrc
SOURCE_DATE_EPOCH=$(date +%s)
if [ -d "${venvDir}" ]; then
echo "Skipping venv creation, '${venvDir}' already exists"
else
echo "Creating new venv environment in path: '${venvDir}'"
# Note that the module venv was only introduced in python 3, so for 2.7
# this needs to be replaced with a call to virtualenv
${pythonPackages.python.interpreter} -m venv "${venvDir}"
fi
# Under some circumstances it might be necessary to add your virtual
# environment to PYTHONPATH, which you can do here too;
PYTHONPATH=$PWD/${venvDir}/${pythonPackages.python.sitePackages}/:$PYTHONPATH
source "${venvDir}/bin/activate"
'';
};
......@@ -64,4 +82,4 @@
};
};
};
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment