init
This commit is contained in:
35
shell.nix
Normal file
35
shell.nix
Normal file
@@ -0,0 +1,35 @@
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
|
||||
let
|
||||
my-python = pkgs.python312;
|
||||
python-with-my-packages = my-python.withPackages
|
||||
(p: with p; [
|
||||
|
||||
]);
|
||||
lib-path = with pkgs; lib.makeLibraryPath [
|
||||
libffi
|
||||
openssl
|
||||
stdenv.cc.cc
|
||||
];
|
||||
in pkgs.mkShell {
|
||||
buildInputs = [
|
||||
python-with-my-packages
|
||||
];
|
||||
shellHook = ''
|
||||
SOURCE_DATE_EPOCH=$(date +%s)
|
||||
export "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${lib-path}"
|
||||
VENV=.venv
|
||||
|
||||
if test ! -d $VENV; then
|
||||
python3 -m venv $VENV
|
||||
fi
|
||||
source ./$VENV/bin/activate
|
||||
export PYTHONPATH=`pwd`/$VENV/${python-with-my-packages.sitePackages}/
|
||||
# export PYTHONPATH=`pwd`/$VENV/${python-with-my-packages.sitePackages}/:$PYTHONPATH
|
||||
pip install -r requirements.txt
|
||||
'';
|
||||
|
||||
postShellHook = ''
|
||||
ln -sf ${python-with-my-packages.sitePackages}/* ./.venv/lib/python3.12/site-packages
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user