Update python envrc

Switch back to using nix and add current src directory to PYTHONPATH
This commit is contained in:
Evie Litherland-Smith 2024-10-02 14:20:23 +01:00
parent 41be433044
commit 4f60cda7ba

View file

@ -234,17 +234,20 @@ nix-mode
envrc-file-mode envrc-file-mode
(python "CC=\"$(nix build nixpkgs#stdenv.cc.cc.lib --print-out-paths --no-link)\"" n ;; (python "CC=\"$(nix build nixpkgs#stdenv.cc.cc.lib --print-out-paths --no-link)\"" n
"ZLIB=\"$(nix build nixpkgs#zlib --print-out-paths --no-link)\"" n ;; "ZLIB=\"$(nix build nixpkgs#zlib --print-out-paths --no-link)\"" n
"PYTHON=\"$(nix build " (p "nixpkgs#python3Full") " --print-out-paths --no-link)/bin/python3\"" n ;; "PYTHON=\"$(nix build " (p "nixpkgs#python3Full") " --print-out-paths --no-link)/bin/python3\"" n
"VENV_DIR=" (p ".venv") n ;; "VENV_DIR=" (p ".venv") n
"export LD_LIBRARY_PATH=\"$CC/lib\":\"$ZLIB/lib\"" n ;; "export LD_LIBRARY_PATH=\"$CC/lib\":\"$ZLIB/lib\"" n
"if [ ! -f $VENV_DIR/bin/activate ]; then" n ;; "if [ ! -f $VENV_DIR/bin/activate ]; then" n
> "$PYTHON -m venv --clear $VENV_DIR" n ;; > "$PYTHON -m venv --clear $VENV_DIR" n
"else" n ;; "else" n
> "$PYTHON -m venv --upgrade $VENV_DIR" n ;; > "$PYTHON -m venv --upgrade $VENV_DIR" n
"fi" n ;; "fi" n
"source $VENV_DIR/bin/activate") ;; "source $VENV_DIR/bin/activate")
(python "use nix" n
"SRC=$(readlink -f " (p "./" ) ")" n
"export PYTHONPATH=$SRC:" q "$PYTHONPATH")
;; Local Variables: ;; Local Variables:
;; mode: lisp-data ;; mode: lisp-data