Issues with packaging a program using GLIB

Hello there,

I am trying to package a program that uses GLib. When running the program I am confronted with the following error message:

(gjs:142442): Gjs-CRITICAL **: 09:46:22.702: JS ERROR: Error: Requiring GLib, version 2.0: Typelib file for namespace 'GLib', version '2.0' not found
@resource:///org/gnome/gjs/modules/script/package.js:14:14
@file:///nix/store/b2mg97bzp9nhdvwja7nnwv98fzg6gwjv-libellus-1.0.3.1/bin/.de.hummdudel.Libellus-wrapped:5:1


(gjs:142442): Gjs-CRITICAL **: 09:46:22.702: Module file:///nix/store/b2mg97bzp9nhdvwja7nnwv98fzg6gwjv-libellus-1.0.3.1/bin/.de.hummdudel.Libellus-wrapped threw an exception

Is there anyone that has an idea on how to fix that? GNOME | nixpkgs didn’t have anything.

Help would be greatly appreciated, thanks!

code at: nixpkgs/pkgs/by-name/li/libellus/package.nix at ff8a576919d4c0c031794b1be1d800f0a49607bb · Nydragon/nixpkgs · GitHub
program in question: GitHub - qwertzuiopy/Libellus: A DnD lexicon / wiki.

You need a wrapper to set GI_TYPELIB_PATH environment variable at runtime, see the Nixpkgs reference manual.

ou will also need glib (contains the typelib itself) in buildInputs, and gobject-introspection setup hook in nativeBuildInputs to find the typelib and pass it to the hook that creates the wrapper.

2 Likes

Thank you for the reply, adding gobject-introspection did indeed fix the issue.

Altough now I get the following error:

(.libellus-wrapped:190786): Gjs-CRITICAL **: 22:36:53.021: JS ERROR: ImportError: Unable to load file from: resource:///de/hummdudel/Libellus/js/main.js (The resource at “/de/hummdudel/Libellus/js/main.js” does not exist)

(.libellus-wrapped:190786): Gjs-CRITICAL **: 22:36:53.022: Module file:///nix/store/cas8ym4grybfn5ljbph8w5gbms94phn4-libellus-1.0.3/bin/.libellus-wrapped threw an exception

I verified and /share/libellus/de.hummdudel.Libellus.src.gresource does include main.js, Would you have any idea on that?

Nixpkgs Reference Manual Did not have any info.

(repo)