about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/tools/pipenv/default.nix43
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 26 insertions, 19 deletions
diff --git a/pkgs/development/tools/pipenv/default.nix b/pkgs/development/tools/pipenv/default.nix
index 1b4815a8687d..de9e02de3f77 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;
 
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index c6b5287a9a99..e4ed786616ab 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9003,7 +9003,7 @@ in
 
   pew = callPackage ../development/tools/pew {};
   poetry = with python3Packages; toPythonApplication poetry;
-  pipenv = python3Packages.callPackage ../development/tools/pipenv {};
+  pipenv = callPackage ../development/tools/pipenv {};
 
   pipewire = callPackage ../development/libraries/pipewire {};