use python venv with nix

This commit is contained in:
Jesse Cirimelli-Low
2026-05-11 10:44:24 -07:00
parent 45e58838d6
commit 91d0eb1d2c
3 changed files with 16 additions and 2 deletions
+1
View File
@@ -19,6 +19,7 @@ compiler/tests/results/
open_pdks/ open_pdks/
dist/ dist/
openram.egg-info/ openram.egg-info/
.venv/
sky130A sky130A
sky130B sky130B
gf180mcuA gf180mcuA
+1 -1
View File
@@ -247,5 +247,5 @@ build_library:
# Build and install the openram library # Build and install the openram library
library: build_library library: build_library
@python3 -m pip install --force dist/openram*.whl @python3 -m pip install --force-reinstall dist/openram*.whl
.PHONY: library .PHONY: library
+14 -1
View File
@@ -38,11 +38,24 @@
pkgs.git pkgs.git
pkgs.gnumake pkgs.gnumake
pkgs.curl pkgs.curl
# Python + pip (user installs, venvs; prefer Nix where possible)
pkgs.python3
pkgs.python3Packages.pip
]; ];
shellHook = '' shellHook = ''
export OPENRAM_USE_CONDA=0 export OPENRAM_USE_CONDA=0
echo "OpenRAM: using tools from Nix devShell" # PEP 668: Nix `python3` is externally managed. Put a repo-local venv first on PATH
# so `make library` uses it. Use $PWD (writable checkout), not `toString self` (nix store).
OPENRAM_VENV="''${OPENRAM_HOME}/.venv"
if [ ! -x "$OPENRAM_VENV/bin/python3" ]; then
echo "OpenRAM: creating venv at $OPENRAM_VENV"
${pkgs.python3}/bin/python3 -m venv "$OPENRAM_VENV"
fi
export VIRTUAL_ENV="$OPENRAM_VENV"
export PATH="$OPENRAM_VENV/bin:$PATH"
echo "OpenRAM: Nix devShell (venv on PATH: $OPENRAM_VENV)"
''; '';
}; };
}); });