43 lines
1.3 KiB
Nix
43 lines
1.3 KiB
Nix
{ pkgs ? import <nixpkgs> {}
|
|
}:
|
|
let
|
|
pythonPackages = pkgs.python3Packages;
|
|
in pkgs.mkShell rec {
|
|
name = "impurePythonEnv";
|
|
venvDir = "/tmp/cmake-init_venv";
|
|
buildInputs = [
|
|
# A Python interpreter including the 'venv' module is required to bootstrap
|
|
# the environment.
|
|
pythonPackages.python
|
|
|
|
# This executes some shell code to initialize a venv in $venvDir before
|
|
# dropping into the shell
|
|
pythonPackages.venvShellHook
|
|
|
|
# Those are dependencies that we would like to use from nixpkgs, which will
|
|
# add them to PYTHONPATH and thus make them accessible from within the venv.
|
|
#pythonPackages.numpy
|
|
#pythonPackages.requests
|
|
pkgs.wget
|
|
|
|
# In this particular example, in order to compile any binary extensions they may
|
|
# require, the Python modules listed in the hypothetical requirements.txt need
|
|
# the following packages to be installed locally:
|
|
#
|
|
];
|
|
|
|
# Run this command, only after creating the virtual environment
|
|
#pip install -r requirements.txt
|
|
postVenvCreation = ''
|
|
unset SOURCE_DATE_EPOCH
|
|
pip install cmake-init
|
|
'';
|
|
|
|
# Now we can execute any commands within the virtual environment.
|
|
# This is optional and can be left out to run pip manually.
|
|
postShellHook = ''
|
|
unset SOURCE_DATE_EPOCH
|
|
'';
|
|
|
|
}
|