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