jakubgs
December 27, 2021, 3:48pm
1
I’m trying to init SoundConverter at 4.0.3
, which you can see here:
{ pkgs, lib, fetchurl, buildPythonPackage,
gtk3, pygobject3, gst-python, gsettings-desktop-schemas, python3Packages }:
buildPythonPackage rec {
pname = "soundconverter";
version = "4.0.3";
src = fetchurl {
url = "https://launchpad.net/${pname}/trunk/${version}/+download/${pname}-${version}.tar.gz";
sha256 = "17di1jb8dsvq0w5a4a7ds8bp115szdvbvn5kg8wvvpy3hbzhccl7";
};
doCheck = false;
# FIXME: Tests still fail with:
# 'Settings schema 'org.soundconverter' is not installed'
#preCheck = let
# gsds = gsettings-desktop-schemas;
#in ''
# export XDG_DATA_DIRS=${gsds}/share/gsettings-schemas/${gsds.name}:./:$XDG_DATA_DIRS
# pwd
This file has been truncated. show original
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
austin
December 29, 2021, 3:21am
2
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!
Biggest hassle is the logic to determine where the data folder is (it loads a .glade
file from there during startup):
# textdomain, because Python's default localedir is pointing to
# /usr/share/locale, whereas flatpaks install their locales to
# /app/share/locale.
# For reference, see https://docs.python.org/3/library/gettext.html#id3
locale.setlocale(locale.LC_ALL, '')
locale.bindtextdomain(NAME, '/app/share/locale')
gettext.bindtextdomain(NAME, '/app/share/locale')
gettext.textdomain(NAME)
else:
# installed with -e, running from the cloned git source
DATA_PATH = os.path.join(SOURCE_PATH, 'data')
try:
import gi
gi.require_version('GstPbutils', '1.0')
gi.require_version('Gst', '1.0')
gi.require_version('Gtk', '3.0')
from gi.repository import Gst, Gtk, GLib, Gdk
except (ImportError, ValueError) as error:
print(('{} needs GTK >= 3.0 (Error: "{}")'.format(NAME, error)))
sys.exit(1)
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
jakubgs
December 29, 2021, 1:02pm
3
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 https://github.com/austinbutler/nixpkgs.git
> g fetch austinbutler soundconverter
> g co soundconverter
> g rev-parse HEAD
6a5579239cef854c23a6a0a3f3f337c3325a6878
> $(nix-build --no-out-link -A pkgs.soundconverter)/bin/soundconverter
...(omitted)...
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.
austin
December 29, 2021, 7:13pm
4
I was running it via ./result/bin/soundconverter
in case it somehow makes a difference.
1 Like
jakubgs
December 30, 2021, 3:51pm
5
I’ve managed to get it working and created a PR:
NixOS:master
← jakubgs:init/soundconverter
opened 03:43PM - 30 Dec 21 UTC
###### Motivation for this change
[SoundConverter](https://soundconverter.org/)… is a clean and simple GUI for converting audio files using GStreamer.
Thanks to @austinbutler for his help in the [Discourse thread](https://discourse.nixos.org/t/how-to-provide-gstreamer-to-a-python-gtk-application/16814).
###### Things done
- Built on platform(s)
- [x] x86_64-linux
- [ ] aarch64-linux
- [ ] x86_64-darwin
- [ ] aarch64-darwin
- [ ] For non-Linux: Is `sandbox = true` set in `nix.conf`? (See [Nix manual](https://nixos.org/manual/nix/stable/command-ref/conf-file.html))
- [ ] Tested, as applicable:
- [NixOS test(s)](https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests) (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
- and/or [package tests](https://nixos.org/manual/nixpkgs/unstable/#sec-package-tests)
- or, for functions and "core" functionality, tests in [lib/tests](https://github.com/NixOS/nixpkgs/blob/master/lib/tests) or [pkgs/test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/test)
- made sure NixOS tests are [linked](https://nixos.org/manual/nixpkgs/unstable/#ssec-nixos-tests-linking) to the relevant packages
- [ ] Tested compilation of all packages that depend on this change using `nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"`. Note: all changes have to be committed, also see [nixpkgs-review usage](https://github.com/Mic92/nixpkgs-review#usage)
- [x] Tested basic functionality of all binary files (usually in `./result/bin/`)
- [22.05 Release Notes (or backporting 21.11 Release notes)](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#generating-2205-release-notes)
- [ ] (Package updates) Added a release notes entry if the change is major or breaking
- [ ] (Module updates) Added a release notes entry if the change is significant
- [ ] (Module addition) Added a release notes entry if adding a new NixOS module
- [ ] (Release notes changes) Ran `nixos/doc/manual/md-to-db.sh` to update generated release notes
- [x] Fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
As far as I can tell the strictDeps = false;
has helped me fix the issues, but not entirely sure why.
jakubgs
December 30, 2021, 3:55pm
6
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
gtk3
- intltool
python3Packages.distutils_extra
wrapGAppsHook
];
+ nativeBuildInputs = with pkgs; [
+ intltool
+ gobject-introspection
+ ];
+
propagatedBuildInputs = with pkgs; [
gobject-introspection
- gst_all_1.gst-plugins-bad
- gst_all_1.gst-plugins-base
- gst_all_1.gst-plugins-good
- gst_all_1.gst-plugins-ugly
python3Packages.pygobject3
];
@@ -35,8 +39,6 @@ python3Packages.buildPythonApplication rec {
"DATA_PATH = '$out/share/soundconverter'"
'';
- strictDeps = false;
-
meta = with lib; {
homepage = "https://soundconverter.org/";
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
milahu
March 3, 2022, 7:14pm
7
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
solution:
buildInputs = [
gtk3 # Pango
gobject-introspection # Pango
gst_all_1.gstreamer
#gst_all_1.gstreamer.dev # gst-inspect
gst_all_1.gst-plugins-base # playbin
(gst_all_1.gst-plugins-good.override { gtkSupport = true; }) # gtksink
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-ugly
gst_all_1.gst-libav
];
full derivation: gaupol.nix
1 Like
Thanks. Added that to my PR.
milahu
March 6, 2022, 4:18pm
9
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.