Skip to content

Commit

Permalink
Added nix shell doodas
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Dec 6, 2023
1 parent a5502ff commit 11f48e9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use nix
layout python3
49 changes: 49 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
with import <nixpkgs> { };

let
pythonPackages = python3Packages;
in pkgs.mkShell rec {
name = "impurePythonEnv";
venvDir = "./.venv";
buildInputs = [
# A Python interpreter including the 'venv' module is required to bootstrap
# the environment.
pythonPackages.python
pylint
black
python311Packages.future
qgis
vscode
xorg.libxcb
qgis
qt5.full
qtcreator
python3
python3Packages.pyqt5
python3Packages.gdal
python3Packages.pytest

# This executes some shell code to initialize a venv in $venvDir before
# dropping into the shell

];

# Run this command, only after creating the virtual environment
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install -r requirements.txt
'';

shellHook = ''
export PYTHONPATH=$PYTHONPATH:`which qgis`/../../share/qgis/python
export QT_QPA_PLATFORM=offscreen
'';

# Now we can execute any commands within the virtual environment.
# This is optional and can be left out to run pip manually.
postShellHook = ''
# allow pip to install wheels
unset SOURCE_DATE_EPOCH
'';

}

0 comments on commit 11f48e9

Please sign in to comment.