[Nix-dev] Inkscape pythonEnv - .sif export - PYTHONPATH wrapping

Marc Weber marco-oweber at gmx.de
Fri Mar 3 15:38:42 CET 2017


A commit turning the list of pythonpackages into pythonEnv broke the
export. The problem is I'm unsure how to suggest a proper fix to fridh at fridh.nl
because there are many ways to fix:

makeWrapper requires shell function toPythonPath provided by ${python}/nix-support/..
which is "gone" using pythonEnv. Possibilities to fix

  1) revert
  2) "rescue" adding python2 to buildInputs (providing toPythonPath)
      see PATCH below
  3) improve pythonEnv lifting toPythonPath from shell to nix world
  4a) improve pythonEnv adding a run-in-python-env sot hat the wrapped
      script looks like
      #!/bin/sh
      /nix/store..../bin/python-env/bin/run-in-env /nix/store/...inkscape "$@"

  4b) make it composable / sourcable

      #!/bin/sh
      source /nix/store..../bin/python-env/nix-support/env
      /nix/store/...inkscape "$@"

No idea which solution is best - thoughts?

People who are maintaining python might want to take care of.

Marc Weber

immediate fix: PATCH

diff --git a/pkgs/applications/graphics/inkscape/default.nix b/pkgs/applications/graphics/inkscape/default.nix
index 2f72d00..53d612f 100644
--- a/pkgs/applications/graphics/inkscape/default.nix
+++ b/pkgs/applications/graphics/inkscape/default.nix
@@ -31,12 +32,23 @@ stdenv.mkDerivation rec {
     libxml2 libxslt glib gtkmm2 glibmm libsigcxx lcms boost gettext
     makeWrapper intltool gsl poppler imagemagick libwpg librevenge
     libvisio libcdr libexif automake114x cmake
+
+    python2 # provides toPythonPath
   ];
 
   enableParallelBuilding = true;
 
   postInstall = ''
     # Make sure PyXML modules can be found at run-time.
+    for i in "$out/bin/"*
+    do
+      wrapProgram "$i" \
+        --prefix PYTHONPATH : $(toPythonPath "${python2Env}") \
+        --prefix PATH       : ${python2Env}/bin || \
+        exit 2
+    done
     rm "$out/share/icons/hicolor/icon-theme.cache"
   '';
 
diff --git a/pkgs/applications/graphics/inkscape/default.nix b/pkgs/applications/graphics/inkscape/default.nix
index 2f72d00..53d612f 100644
--- a/pkgs/applications/graphics/inkscape/default.nix
+++ b/pkgs/applications/graphics/inkscape/default.nix
@@ -31,12 +32,23 @@ stdenv.mkDerivation rec {
     libxml2 libxslt glib gtkmm2 glibmm libsigcxx lcms boost gettext
     makeWrapper intltool gsl poppler imagemagick libwpg librevenge
     libvisio libcdr libexif automake114x cmake
+
+    python2 # provides toPythonPath
   ];
 
   enableParallelBuilding = true;
 
   postInstall = ''
     # Make sure PyXML modules can be found at run-time.
+
+    # Make sure PyXML modules can be found at run-time.
+    for i in "$out/bin/"*
+    do
+      wrapProgram "$i" \
+        --prefix PYTHONPATH : $(toPythonPath "${python2Env}") \
+        --prefix PATH       : ${python2Env}/bin || \
+        exit 2
+    done
     rm "$out/share/icons/hicolor/icon-theme.cache"
   '';
 
diff --git a/pkgs/applications/graphics/inkscape/default.nix b/pkgs/applications/graphics/inkscape/default.nix
index 2f72d00..53d612f 100644
--- a/pkgs/applications/graphics/inkscape/default.nix
+++ b/pkgs/applications/graphics/inkscape/default.nix
@@ -31,12 +32,23 @@ stdenv.mkDerivation rec {
     libxml2 libxslt glib gtkmm2 glibmm libsigcxx lcms boost gettext
     makeWrapper intltool gsl poppler imagemagick libwpg librevenge
     libvisio libcdr libexif automake114x cmake
+
+    python2 # provides toPythonPath
   ];
 
   enableParallelBuilding = true;
 
   postInstall = ''
     # Make sure PyXML modules can be found at run-time.
+
+    # Make sure PyXML modules can be found at run-time.
+    for i in "$out/bin/"*
+    do
+      wrapProgram "$i" \
+        --prefix PYTHONPATH : $(toPythonPath "${python2Env}") \
+        --prefix PATH       : ${python2Env}/bin || \
+        exit 2
+    done
     rm "$out/share/icons/hicolor/icon-theme.cache"
   '';
 
diff --git a/pkgs/applications/graphics/inkscape/default.nix b/pkgs/applications/graphics/inkscape/default.nix
index 2f72d00..53d612f 100644
--- a/pkgs/applications/graphics/inkscape/default.nix
+++ b/pkgs/applications/graphics/inkscape/default.nix
@@ -31,12 +32,23 @@ stdenv.mkDerivation rec {
     libxml2 libxslt glib gtkmm2 glibmm libsigcxx lcms boost gettext
     makeWrapper intltool gsl poppler imagemagick libwpg librevenge
     libvisio libcdr libexif automake114x cmake
+
+    python2 # provides toPythonPath
   ];
 
   enableParallelBuilding = true;
 
   postInstall = ''
     # Make sure PyXML modules can be found at run-time.
+
+    # Make sure PyXML modules can be found at run-time.
+    for i in "$out/bin/"*
+    do
+      wrapProgram "$i" \
+        --prefix PYTHONPATH : $(toPythonPath "${python2Env}") \
+        --prefix PATH       : ${python2Env}/bin || \
+        exit 2
+    done
     rm "$out/share/icons/hicolor/icon-theme.cache"
   '';
 


More information about the nix-dev mailing list