diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1644a0a --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +use nix +layout python3 diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..d681614 --- /dev/null +++ b/default.nix @@ -0,0 +1,49 @@ +with import { }; + +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 + ''; + +}