Last active
January 9, 2023 09:49
-
-
Save stefanDeveloper/8f36828b3aa073237ddb0668ca9da970 to your computer and use it in GitHub Desktop.
NFStream Nix-Shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> { }; | |
let | |
pythonPackages = python39Packages; | |
in pkgs.mkShell rec { | |
venvDir = "./.venv"; | |
name = "nfstream"; | |
requirements = "requirements.txt"; | |
buildInputs = [ | |
# Python | |
pythonPackages.setuptools | |
pythonPackages.virtualenv # run virtualenv . | |
pythonPackages.pip | |
pythonPackages.pyqt5 # avoid installing via pip | |
# This execute some shell code to initialize a venv in $venvDir before | |
# dropping into the shell | |
pythonPackages.venvShellHook | |
# C tools | |
autoconf | |
autoreconfHook | |
automake | |
libtool | |
pkg-config | |
zlib | |
bison | |
gettext | |
json_c | |
libdbusmenu | |
bluez | |
libnl | |
libpcap | |
flex | |
]; | |
shellHook = '' | |
# fixes libstdc++ issues and libgl.so issues | |
LD_LIBRARY_PATH=${zlib}/lib/:${stdenv.cc.cc.lib}/lib/:/run/opengl-driver/lib/ | |
# fixes xcb issues : | |
QT_PLUGIN_PATH=${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix} | |
SOURCE_DATE_EPOCH=$(date +%s) | |
QT_XCB_GL_INTEGRATION="none" | |
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}/:${pypy}:$PYTHONPATH | |
source "${venvDir}/bin/activate" | |
echo "Upgrading pip to latest version" | |
python -m pip install --upgrade pip | |
if [ -f "./${requirements}" ]; then | |
echo "Install '${requirements}'" | |
pip install -r ${requirements} | |
fi | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment