Nix-ld: No GSettings schemas are installed on the system

I’m trying to run the app GitHub - ClementGre/PDF4Teachers: PDF editing software for teachers, focused on productivity. PDF4Teachers keeps recorded previous annotations, and offers features like marking scale, PDF conversion, vectorial drawing... (downloaded and extracted the tar.gz and executed the binary after enabling nix-ld), but when I try to open a file/folder it crashes with:

(PDF4Teachers:168878): GLib-GIO-ERROR **: 14:04:46.541: No GSettings schemas are installed on the system

any idea what’s going wrong? I guess nixos specifies settings in a non-standard place that confuses this packages? What can I/the dev do to fix this?

EDIT

I managed to “”“fix”“” this via:

XDG_DATA_DIRS=/nix/store/6546hslddlnvg5fmx8vv3man2blcprib-gsettings-desktop-schemas-49.1/share/gsettings-schemas/gsettings-desktop-schemas-49.1:/nix/store/cs86fhm7hsgxm20m826cl5qqc4nyg33s-gtk+3-3.24.51/share/gsettings-schemas/gtk+3-3.24.51/:$XDG_DATA_DIRS /tmp/pdf4teachers/bin/PDF4Teachers

but it is really ugly. How am I supposed to run this kind of apps via nix-ld?

I always fixed this problem by playing around with wrapGApps hooks https://nixos.org/manual/nixpkgs/stable/#sec-language-gnome. Couldn’t you just wrap the program/set the environment variable in a nix shell?

1 Like

Thanks, but I wish I could just use nix-ld “as it” to fake a standard linux distribution without needing to manually do some sort of wrapping…

nix-ld is for using the dynamically loaded libraries from nixpkgs. It will not help with things like gsettings schemas.

Would it make sense to install them globally? Or can’t nix-ld set these environment variables automagically?

nix-ld is a link loader. It isn’t a universal ‘let me forget that I’m running on a non-standard Linux distribution’ tool. It could, theoretically, be one component of such a tool.

The best all-in ‘forget I’m on NixOS’ tool that currently exists, IMO, is distrobox. But if you regularly find yourself wanting to disengage from the constraints of NixOS, you should consider installing Nix on a distro that isn’t NixOS. You can still get, e.g., declarative configuration of services by running NixOS containers for those services. I did this for many years.

1 Like

No, it doesn’t, but you can export the variable in your configuration.nix. I recently had to do this due to an issue (unrelated to this).

environment.extraInit = ‘’
  export XDG_DATA_DIRS=“$XDG_DATA_DIRS:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}”
‘’;
1 Like

Loader can theoretically initialize environment variables. So I created Allow creating some environment variables (compatibility gtk, pxthon…) · Issue #215 · nix-community/nix-ld · GitHub to ask support for custom environment variables in nix-ld.

Thanks, but I find that solutions based on containers have too poor integration with the host file system, being fairly heavy, and often fail when mounting is required (e.g. fuse for appimages), so I’d prefer a no-container solution. And I also feel like NixOS should provide NixOS-specific tools to deal with that and be independent of other distro, it feels wrong to say that I need a container with ubuntu to do any advanced thing/code/….

Thanks! I wish there is a way to do it without polluting other apps (afraid of conflicts here), hence the creation of the above feature request.

For the fun I tried it here, but it failed, and the experience was fairly bad… First I lost ability to use history via zsh (I’m spamed with staff like autocomplete:_main_complete:old:138: command not found: _autocomplete__history_lines when I try to access it, and autocomplete:_main_complete:new:post:3: command not found: _autocomplete__unambiguous if I try to autocomplete), and more problematic when I start it I get an error:

    ./PDF4Teachers                                                                                                                                                                                             ─╯
WARNING: Unknown module: PDF4Teachers.master.merged.module specified to --add-reads
WARNING: Unknown module: PDF4Teachers.master.merged.module specified to --add-exports
Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: /home/leo/.openjfx/cache/22+30/amd64/libprism_es2.so: libXxf86vm.so.1: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce nom
java.lang.UnsatisfiedLinkError: /home/leo/.openjfx/cache/22+30/amd64/libprism_es2.so: libXxf86vm.so.1: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce nom
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(Unknown Source)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
        at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.base/java.lang.Runtime.load0(Unknown Source)
        at java.base/java.lang.System.load(Unknown Source)
        at javafx.graphics@22/com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(Unknown Source)
        at javafx.graphics@22/com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(Unknown Source)
        at javafx.graphics@22/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(Unknown Source)
        at javafx.graphics@22/com.sun.glass.utils.NativeLibLoader.loadLibrary(Unknown Source)
        at javafx.graphics@22/com.sun.prism.es2.ES2Pipeline.lambda$static$0(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Unknown Source)
        at javafx.graphics@22/com.sun.prism.es2.ES2Pipeline.<clinit>(Unknown Source)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Unknown Source)
        at java.base/java.lang.Class.forName(Unknown Source)
        at javafx.graphics@22/com.sun.prism.GraphicsPipeline.createPipeline(Unknown Source)
        at javafx.graphics@22/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(Unknown Source)
        at javafx.graphics@22/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at java.base/sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.UnsupportedOperationException: Unable to load glass GTK library.
        at javafx.graphics@22/com.sun.glass.ui.gtk.GtkApplication.lambda$new$5(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Unknown Source)
        at javafx.graphics@22/com.sun.glass.ui.gtk.GtkApplication.<init>(Unknown Source)
        at javafx.graphics@22/com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(Unknown Source)
        at javafx.graphics@22/com.sun.glass.ui.Application.run(Unknown Source)
        at javafx.graphics@22/com.sun.javafx.tk.quantum.QuantumToolkit.startup(Unknown Source)
        at javafx.graphics@22/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
        at javafx.graphics@22/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
        at javafx.graphics@22/com.sun.javafx.application.LauncherImpl.startToolkit(Unknown Source)
        at javafx.graphics@22/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)
        at javafx.graphics@22/com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)
        ... 3 more