1diff --git a/setup.py b/setup.py
2index 0c8d8f16..565ef8ef 100644
3--- a/setup.py
4+++ b/setup.py
5@@ -172,21 +172,7 @@ class CMakeBuild(build_ext):
6 subprocess.check_call(cmake_build, cwd=build_folder)
7
8 def num_available_cpu_cores(ram_per_build_process_in_gb):
9- if 'TRAVIS' in os.environ and os.environ['TRAVIS']=='true':
10- # When building on travis-ci, just use 2 cores since travis-ci limits
11- # you to that regardless of what the hardware might suggest.
12- return 2
13- try:
14- mem_bytes = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES')
15- mem_gib = mem_bytes/(1024.**3)
16- num_cores = multiprocessing.cpu_count()
17- # make sure we have enough ram for each build process.
18- mem_cores = int(floor(mem_gib/float(ram_per_build_process_in_gb)+0.5));
19- # We are limited either by RAM or CPU cores. So pick the limiting amount
20- # and return that.
21- return max(min(num_cores, mem_cores), 1)
22- except ValueError:
23- return 2 # just assume 2 if we can't get the os to tell us the right answer.
24+ return os.getenv("NIX_BUILD_CORES", 1)
25
26
27 from setuptools.command.test import test as TestCommand