diff --git a/pkgs/applications/audio/rhythmbox/default.nix b/pkgs/applications/audio/rhythmbox/default.nix index 394ccc3b723d..9929a32aabbf 100644 --- a/pkgs/applications/audio/rhythmbox/default.nix +++ b/pkgs/applications/audio/rhythmbox/default.nix @@ -101,7 +101,7 @@ stdenv.mkDerivation rec { preFixup = '' gappsWrapperArgs+=( - --prefix PYTHONPATH : "${python3.pkgs.pygobject3}/${python3.sitePackages}:$out/lib/rhythmbox/plugins/" + --prefix PYTHONPATH : "$out/lib/rhythmbox/plugins/" ) ''; diff --git a/pkgs/applications/editors/gnome-builder/default.nix b/pkgs/applications/editors/gnome-builder/default.nix index fc3f3fd27474..da36d5f111f7 100644 --- a/pkgs/applications/editors/gnome-builder/default.nix +++ b/pkgs/applications/editors/gnome-builder/default.nix @@ -73,7 +73,6 @@ stdenv.mkDerivation rec { ninja pkg-config python3 - python3.pkgs.wrapPython wrapGAppsHook4 ]; @@ -137,12 +136,8 @@ stdenv.mkDerivation rec { meson test --print-errorlogs ''; - pythonPath = with python3.pkgs; requiredPythonModules [ pygobject3 ]; - preFixup = '' - buildPythonPath "$out $pythonPath" gappsWrapperArgs+=( - --prefix PYTHONPATH : "$program_PYTHONPATH" # For sysprof-agent --prefix PATH : "${sysprof}/bin" ) diff --git a/pkgs/applications/networking/mailreaders/astroid/default.nix b/pkgs/applications/networking/mailreaders/astroid/default.nix index 739f45fd4ee9..518d47a9a40a 100644 --- a/pkgs/applications/networking/mailreaders/astroid/default.nix +++ b/pkgs/applications/networking/mailreaders/astroid/default.nix @@ -47,7 +47,7 @@ stdenv.mkDerivation rec { sed -i "s~ -geom 10x10~~g" src/config.cc ''; - pythonPath = with python3.pkgs; requiredPythonModules [ pygobject3 ] ++ extraPythonPackages; + pythonPath = with python3.pkgs; requiredPythonModules extraPythonPackages; preFixup = '' buildPythonPath "$out $pythonPath" gappsWrapperArgs+=( diff --git a/pkgs/applications/networking/newsreaders/liferea/default.nix b/pkgs/applications/networking/newsreaders/liferea/default.nix index d7643a6f07e8..0851d0f30e79 100644 --- a/pkgs/applications/networking/newsreaders/liferea/default.nix +++ b/pkgs/applications/networking/newsreaders/liferea/default.nix @@ -73,14 +73,9 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - pythonPath = with python3Packages; [ - pygobject3 - pycairo - ]; - - preFixup = '' - buildPythonPath "$out $pythonPath" - gappsWrapperArgs+=(--prefix PYTHONPATH : "$program_PYTHONPATH") + postFixup = '' + buildPythonPath ${python3Packages.pycairo} + patchPythonScript $out/lib/liferea/plugins/trayicon.py ''; passthru.updateScript = gitUpdater { diff --git a/pkgs/applications/video/xplayer/default.nix b/pkgs/applications/video/xplayer/default.nix index 20a9772021a9..baa8fcb95be0 100644 --- a/pkgs/applications/video/xplayer/default.nix +++ b/pkgs/applications/video/xplayer/default.nix @@ -25,13 +25,6 @@ , xapp , yelp-tools }: -let - pythonenv = python3.withPackages (ps: [ - ps.pygobject3 - ps.dbus-python # For one plugin - ]); -in - stdenv.mkDerivation rec { pname = "xplayer"; version = "2.4.4"; @@ -66,6 +59,7 @@ stdenv.mkDerivation rec { intltool itstool pkg-config + python3.pkgs.wrapPython yelp-tools gobject-introspection ]; @@ -82,15 +76,15 @@ stdenv.mkDerivation rec { libpeas libxml2 libxplayer-plparser - pythonenv + python3 xapp # to satisfy configure script - pythonenv.pkgs.pygobject3 + python3.pkgs.pygobject3 ]; - postInstall = '' - wrapProgram $out/bin/xplayer \ - --prefix PATH : ${lib.makeBinPath [ pythonenv ]} + postFixup = '' + buildPythonPath ${python3.pkgs.dbus-python} + patchPythonScript $out/lib/xplayer/plugins/dbus/dbusservice.py ''; meta = with lib; { diff --git a/pkgs/desktops/gnome/core/totem/default.nix b/pkgs/desktops/gnome/core/totem/default.nix index 24c637909a32..1f6755002f01 100644 --- a/pkgs/desktops/gnome/core/totem/default.nix +++ b/pkgs/desktops/gnome/core/totem/default.nix @@ -91,9 +91,7 @@ stdenv.mkDerivation rec { adwaita-icon-theme gnome-desktop gsettings-desktop-schemas - # for plug-ins python3Packages.pygobject3 - python3Packages.dbus-python ]; nativeCheckInputs = [ @@ -124,8 +122,6 @@ stdenv.mkDerivation rec { runHook postCheck ''; - wrapPrefixVariables = [ "PYTHONPATH" ]; - passthru = { updateScript = gnome.updateScript { packageName = "totem"; diff --git a/pkgs/desktops/mate/pluma/default.nix b/pkgs/desktops/mate/pluma/default.nix index 665e1b49a436..ed7d54e9469b 100644 --- a/pkgs/desktops/mate/pluma/default.nix +++ b/pkgs/desktops/mate/pluma/default.nix @@ -32,6 +32,7 @@ stdenv.mkDerivation rec { itstool perl pkg-config + python3.pkgs.wrapPython wrapGAppsHook ]; @@ -47,6 +48,16 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; + pythonPath = with python3.pkgs; [ + pycairo + six + ]; + + postFixup = '' + buildPythonPath "$pythonPath" + patchPythonScript $out/lib/pluma/plugins/snippets/Snippet.py + ''; + passthru.updateScript = mateUpdateScript { inherit pname; }; meta = with lib; { diff --git a/pkgs/development/libraries/libpeas/2.x.nix b/pkgs/development/libraries/libpeas/2.x.nix index 547d7f5c27ef..38e4fe055085 100644 --- a/pkgs/development/libraries/libpeas/2.x.nix +++ b/pkgs/development/libraries/libpeas/2.x.nix @@ -1,6 +1,7 @@ { stdenv , lib , fetchurl +, substituteAll , pkg-config , gi-docgen , gobject-introspection @@ -25,6 +26,16 @@ stdenv.mkDerivation rec { hash = "sha256-ndwdUfOGY9pN9SFjBRt7LOo6JCz67p9afhQPB4TIqnc="; }; + patches = [ + # Make PyGObject’s gi library available. + (substituteAll { + src = ./fix-paths.patch; + pythonPaths = lib.concatMapStringsSep ", " (pkg: "'${pkg}/${python3.sitePackages}'") [ + python3.pkgs.pygobject3 + ]; + }) + ]; + depsBuildBuild = [ pkg-config ]; diff --git a/pkgs/development/libraries/libpeas/default.nix b/pkgs/development/libraries/libpeas/default.nix index 70d33d86ad19..f0b6023117d9 100644 --- a/pkgs/development/libraries/libpeas/default.nix +++ b/pkgs/development/libraries/libpeas/default.nix @@ -1,6 +1,7 @@ { stdenv , lib , fetchurl +, substituteAll , meson , ninja , pkg-config @@ -12,6 +13,7 @@ , gobject-introspection , python3 , ncurses +, wrapGAppsHook }: stdenv.mkDerivation rec { @@ -25,6 +27,16 @@ stdenv.mkDerivation rec { sha256 = "KXy5wszNjoYXYj0aPoQVtFMLjlqJPjUnu/0e3RMje0w="; }; + patches = [ + # Make PyGObject’s gi library available. + (substituteAll { + src = ./fix-paths.patch; + pythonPaths = lib.concatMapStringsSep ", " (pkg: "'${pkg}/${python3.sitePackages}'") [ + python3.pkgs.pygobject3 + ]; + }) + ]; + depsBuildBuild = [ pkg-config ]; @@ -36,6 +48,7 @@ stdenv.mkDerivation rec { gettext gi-docgen gobject-introspection + wrapGAppsHook ]; buildInputs = [ diff --git a/pkgs/development/libraries/libpeas/fix-paths.patch b/pkgs/development/libraries/libpeas/fix-paths.patch new file mode 100644 index 000000000000..c54cdd8873f5 --- /dev/null +++ b/pkgs/development/libraries/libpeas/fix-paths.patch @@ -0,0 +1,14 @@ +diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c +index 26edbf3..0d65ada 100644 +--- a/loaders/python/peas-plugin-loader-python.c ++++ b/loaders/python/peas-plugin-loader-python.c +@@ -248,6 +248,9 @@ peas_plugin_loader_python_initialize (PeasPluginLoader *loader) + goto python_init_error; + } + ++ /* Add PyGObject to path */ ++ PyRun_SimpleString("import site; import functools; functools.reduce(lambda k, p: site.addsitedir(p, k), [@pythonPaths@], site._init_pathinfo())"); ++ + /* Initialize PyGObject */ + pygobject_init (PYGOBJECT_MAJOR_VERSION, + PYGOBJECT_MINOR_VERSION,