How to provide Gstreamer to a python/gtk application

I’m trying to init SoundConverter at 4.0.3 , which you can see here:

But when I run it I get an error about Gstreamer plugin missing:

 > $(nix-build --no-out-link -A pkgs.soundconverter)/bin/soundconverter
soundconverter needs GTK >= 3.0 (Error: "Namespace GstPbutils not available")

Which I guess means just adding things like gst_all_1.gst-plugins-good and gst-python in propagatedBuildInputs is not enough to make it work. I’m missing something in how to provide the dependencies, or I’m missing some specific dependency.

Various posts online suggest it’s lack of gir1.2-gst-plugins-base which is “GObject introspection data for the GStreamer Plugins Base library”. I’m already prividing pygobject3 and gst-python, but I guess that’s not enough.

1 Like

I’m able to run it and convert a file with these changes: Comparing jakubgs:init/soundconverter...austinbutler:soundconverter · jakubgs/nixpkgs · GitHub

Won’t claim they are exactly as you should submit for a PR though! :stuck_out_tongue_closed_eyes:

Biggest hassle is the logic to determine where the data folder is (it loads a .glade file from there during startup):

For that I added a substitution.

If you do a PR it should probably be moved to pkgs/applications/audio/soundconverter, unless it’s intended to be imported by other packages.

1 Like

Thanks for looking into it! I think you are definitely onto something with that DATA_PATH fix, but I’m still getting the same error from your branch:

 > g remote add austinbutler 
 > g fetch austinbutler soundconverter
 > g co soundconverter
 > g rev-parse HEAD
 > $(nix-build --no-out-link -A pkgs.soundconverter)/bin/soundconverter
soundconverter needs GTK >= 3.0 (Error: "Namespace GstPbutils not available")

Which doesn’t seem to be related to DATA_PATH at all. So there’s something else I’m missing.

I’ll work on this a bit more tomorrow. I’d like to have this package available so I’ll definitely make a PR once I get this going. And thanks for the suggestion on the path correction.

I was running it via ./result/bin/soundconverter in case it somehow makes a difference.

1 Like

I’ve managed to get it working and created a PR:

As far as I can tell the strictDeps = false; has helped me fix the issues, but not entirely sure why.

Actually, I got this working without using strictDeps = false like this:

diff --git a/pkgs/applications/audio/soundconverter/default.nix b/pkgs/applications/audio/soundconverter/default.nix
index 3a3a73c5c72..87810c7d11e 100644
--- a/pkgs/applications/audio/soundconverter/default.nix
+++ b/pkgs/applications/audio/soundconverter/default.nix
@@ -14,18 +14,22 @@ python3Packages.buildPythonApplication rec {
   doCheck = false;
   buildInputs = with pkgs; [
+    gst_all_1.gst-plugins-bad
+    gst_all_1.gst-plugins-base
+    gst_all_1.gst-plugins-good
+    gst_all_1.gst-plugins-ugly
-    intltool
+  nativeBuildInputs = with pkgs; [
+    intltool
+    gobject-introspection
+  ];
   propagatedBuildInputs = with pkgs; [
-    gst_all_1.gst-plugins-bad
-    gst_all_1.gst-plugins-base
-    gst_all_1.gst-plugins-good
-    gst_all_1.gst-plugins-ugly
@@ -35,8 +39,6 @@ python3Packages.buildPythonApplication rec {
       "DATA_PATH = '$out/share/soundconverter'"
-  strictDeps = false;
   meta = with lib; {
     homepage = "";
     description = "Leading audio file converter for the GNOME Desktop";

Not sure why but it appears gobject-introspection needs to be both in nativeBuildInputs and propagatedBuildInputs because if it’s not in propagatedBuildInputs I get:

soundconverter needs GTK >= 3.0 (Error: "Namespace GstPbutils not available")

And if it’s not in nativeBuildInputs, then I get:

GLib-GIO-ERROR **: 16:53:53.141: No GSettings schemas are installed on the system
1 Like

i was stuck at the error

GStreamer found, but gtksink missing. Try installing gst-plugins-good.

problem is, gst_all_1.gst-plugins-good does not provide gtksink by default


  buildInputs = [
    gtk3 # Pango
    gobject-introspection # Pango

    gst_all_1.gstreamer # gst-inspect
    gst_all_1.gst-plugins-base # playbin
    (gst_all_1.gst-plugins-good.override { gtkSupport = true; }) # gtksink

full derivation: gaupol.nix

1 Like

Thanks. Added that to my PR.

sorry for confusing

the error gtksink missing is thrown by gaupol, not by soundconverter
probably soundconverter works without gtksink

I created a NixOS Wiki page for GStreamer: GStreamer - NixOS Wiki. Maybe you could add a section for hints on Python?

1 Like

Python does not really require anything different from what is already described in the Nixpkgs manual. The main stumbling point here appeared to be that gtksink is not provided by default.