Unfortunately, that is not correct. At least for the GTK case. pygtk
are abandoned bindings that only work on Python 2.
The modern gobject-introspection
-based bindings (e.g. from gi.repository import Gtk
) are usually provided by the regular library packages, so that would be gtk3
and gst_all_1.gstreamer
. The package containing the magical gi
module is python3.pkgs.pygobject3
.
Some packages also use “pygobject overrides” to make the generated bindings more idiomatic. That is the case with GStreamer which has python3.pkgs.gst-python
but not GTK.
The bindings are located at runtime with the help of GI_TYPELIB_PATH
environment variable. In nixpkgs, we use gobject-introspection
package setup hook to pick the bindings from buildInputs
and set the env var and wrapGAppsHook
to pass the environment variable to binaries. See the relevant section of the nixpkgs manual for more information.
Something like this
nix-shell -p gobject-introspection -p gtk3 -p gst_all_1.gstreamer -p 'python3.withPackages (p: with p; [pygobject3 gst-python])' --run python3
or better create a dedicated file
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
name = "gstreamer-with-gtk";
nativeBuildInputs = [
pkgs.gobject-introspection
];
buildInputs = [
pkgs.gtk3
pkgs.gst_all_1.gstreamer
(pkgs.python3.withPackages (p: with p; [
pygobject3 gst-python
]))
];
}