diff --git a/gitlab/before_build.sh b/gitlab/before_build.sh
index 6a794e672003d32dd0e1fbb4a4d607142934a96c..f620e9a7d0ebee14fd12d2ffeb2ffe0cf6f81170 100755
--- a/gitlab/before_build.sh
+++ b/gitlab/before_build.sh
@@ -9,6 +9,7 @@ check_env PYTHON_VER
 check_env CONDA_PREFIX
 check_env ARCH
 check_env PREFIX
+check_env CI_PROJECT_NAME
 
 WHEELS_REPOSITORY="${DOCSERVER}/software/bob/wheels/gitlab/"
 WHEELS_SERVER=`echo ${DOCSERVER} | sed 's;https\?://;;'`
@@ -54,16 +55,23 @@ else
   log_info "Using python: ${use_python}"
 fi
 
+PIPOPTS="--find-links ${WHEELS_REPOSITORY} --trusted-host ${WHEELS_SERVER}"
+PIPOPTS="${PIPOPTS} --use-wheel --pre"
+# zc.recipe.egg cannot be installed via wheels, so we need this hack...
+if [ "${CI_PROJECT_NAME}" != "bob.buildout" ]; then
+  PIPOPTS="${PIPOPTS} --no-index"
+fi
+
 # Install this package's build dependencies
 if [ -e requirements.txt ]; then
-  run_cmd ${use_pip} install --find-links ${WHEELS_REPOSITORY} --use-wheel --no-index --trusted-host ${WHEELS_SERVER} --pre --requirement requirements.txt
+  run_cmd ${use_pip} install ${PIPOPTS} --requirement requirements.txt
 else
   log_info "No requirements.txt file found, skipping 'pip install <build-deps>'..."
 fi
 
 # Install this package's test dependencies
 if [ -e test-requirements.txt ]; then
-  run_cmd ${use_pip} install --find-links ${WHEELS_REPOSITORY} --use-wheel --no-index --trusted-host ${WHEELS_SERVER} --pre --requirement test-requirements.txt
+  run_cmd ${use_pip} install ${PIPOPTS} --requirement test-requirements.txt
 else
   log_info "No test-requirements.txt file found, skipping 'pip install <test-deps>'..."
 fi