summary refs log tree commit diff
path: root/pkgs/development/tools
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools')
-rw-r--r--pkgs/development/tools/pipenv/default.nix43
1 files changed, 25 insertions, 18 deletions
diff --git a/pkgs/development/tools/pipenv/default.nix b/pkgs/development/tools/pipenv/default.nix
index 1b4815a8687..de9e02de3f7 100644
--- a/pkgs/development/tools/pipenv/default.nix
+++ b/pkgs/development/tools/pipenv/default.nix
@@ -1,17 +1,22 @@
 { lib
-, buildPythonApplication
-, certifi
-, setuptools
-, invoke
-, parver
-, pip
-, requests
-, virtualenv
-, fetchPypi
-, virtualenv-clone
+, python3
 }:
 
-buildPythonApplication rec {
+with python3.pkgs;
+
+let
+
+  runtimeDeps = [
+    certifi
+    setuptools
+    pip
+    virtualenv
+    virtualenv-clone
+  ];
+
+  pythonEnv = python3.withPackages(ps: with ps; [ virtualenv ]);
+
+in buildPythonApplication rec {
   pname = "pipenv";
   version = "2018.11.26";
 
@@ -22,15 +27,17 @@ buildPythonApplication rec {
 
   LC_ALL = "en_US.UTF-8";
 
+  postPatch = ''
+    # pipenv invokes python in a subprocess to create a virtualenv
+    # it uses sys.executable which will point in our case to a python that
+    # does not have virtualenv.
+    substituteInPlace pipenv/core.py \
+      --replace "vistir.compat.Path(sys.executable).absolute().as_posix()" "vistir.compat.Path('${pythonEnv.interpreter}').absolute().as_posix()"
+  '';
+
   nativeBuildInputs = [ invoke parver ];
 
-  propagatedBuildInputs = [
-    certifi
-    setuptools
-    pip
-    virtualenv
-    virtualenv-clone
-  ];
+  propagatedBuildInputs = runtimeDeps;
 
   doCheck = false;