summary refs log tree commit diff
path: root/pkgs/development/tools/poetry2nix/poetry2nix/pkgs/poetry/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/poetry2nix/poetry2nix/pkgs/poetry/default.nix')
-rw-r--r--pkgs/development/tools/poetry2nix/poetry2nix/pkgs/poetry/default.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/pkgs/poetry/default.nix b/pkgs/development/tools/poetry2nix/poetry2nix/pkgs/poetry/default.nix
index d06a1c1d6ae..70470ba1722 100644
--- a/pkgs/development/tools/poetry2nix/poetry2nix/pkgs/poetry/default.nix
+++ b/pkgs/development/tools/poetry2nix/poetry2nix/pkgs/poetry/default.nix
@@ -14,12 +14,18 @@ poetry2nix.mkPoetryApplication {
 
   # "Vendor" dependencies (for build-system support)
   postPatch = ''
-    for path in ''${PYTHONPATH//:/ }; do echo $path; done | uniq | while read path; do
-      echo "sys.path.insert(0, \"$path\")" >> poetry/__init__.py
+    echo "import sys" >> poetry/__init__.py
+    for path in $propagatedBuildInputs; do
+        echo "sys.path.insert(0, \"$path\")" >> poetry/__init__.py
     done
   '';
 
   postInstall = ''
+    # Figure out the location of poetry.core
+    # As poetry.core is using the same root import name as the poetry package and the python module system wont look for the root
+    # in the separate second location we need to link poetry.core to poetry
+    ln -s $(python -c 'import poetry.core; import os.path; print(os.path.dirname(poetry.core.__file__))') $out/${python.sitePackages}/poetry/core
+
     mkdir -p "$out/share/bash-completion/completions"
     "$out/bin/poetry" completions bash > "$out/share/bash-completion/completions/poetry"
     mkdir -p "$out/share/zsh/vendor-completions"