From d6a7ce0aa0d56d154369810fe2b60e0dae00d9a9 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 6 Dec 2025 17:57:05 +0100 Subject: [PATCH] Fix: Skip venv/pip installation inside Nix shell and add fallback for _requirements.txt (see conversation: https://chatgpt.com/share/69345df2-a960-800f-8395-92a7c3a6629f) --- Makefile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4e7ed8b..5befb7d 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,10 @@ test: build install: + @if [ -n "$$IN_NIX_SHELL" ]; then \ + echo "Nix shell detected (IN_NIX_SHELL=1). Skipping venv/pip install – handled by Nix flake."; \ + exit 0; \ + fi @echo "Making 'main.py' executable..." @chmod +x main.py @echo "Checking if global user virtual environment exists..." @@ -49,7 +53,16 @@ install: @echo "Installing required Python packages into $$HOME/.venvs/pkgmgr..." @$$HOME/.venvs/pkgmgr/bin/python -m ensurepip --upgrade @$$HOME/.venvs/pkgmgr/bin/pip install --upgrade pip setuptools wheel - @$$HOME/.venvs/pkgmgr/bin/pip install -r requirements.txt + @echo "Looking for requirements.txt / _requirements.txt..." + @if [ -f requirements.txt ]; then \ + echo "Installing Python packages from requirements.txt..."; \ + $$HOME/.venvs/pkgmgr/bin/pip install -r requirements.txt; \ + elif [ -f _requirements.txt ]; then \ + echo "Installing Python packages from _requirements.txt..."; \ + $$HOME/.venvs/pkgmgr/bin/pip install -r _requirements.txt; \ + else \ + echo "No requirements.txt or _requirements.txt found, skipping dependency installation."; \ + fi @echo "Ensuring $$HOME/.bashrc and $$HOME/.zshrc exist..." @touch "$$HOME/.bashrc" "$$HOME/.zshrc" @echo "Ensuring automatic activation of $$HOME/.venvs/pkgmgr for this user..."