Which package includes `org.gtk.gtk4.Settings.FileChooser`?

Hello guys! I’m trying to compile a rust-program with cargo run but I’m getting the follow error message:

(flakeshot:172220): GLib-GIO-ERROR **: 12:09:24.675: Settings schema 'org.gtk.gtk4.Settings.FileChooser' is not installed
Trace/breakpoint trap: oops, process 'cargo' core dumped

may I ask which package includes this org.gtk.gtk4.Settings.FileChooser?

Here’s the devShell` I’m using.

I would think gtk4. Which you already have in the build inputs. So, hmmmm…

but gtk4 is already included.

Yes, I see that now. What happens if you do something like find /nix/store -name *FileChooser*

/nix/store/6qp789r70ka5ahxfzrr9l3h6szclsgsr-gtk+3-3.24.38/share/gsettings-schemas/gtk+3-3.24.38/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml
/nix/store/vv2cg9d8552rb8bwax0g89va7cgi7xdk-gtk4-4.10.4/share/gsettings-schemas/gtk4-4.10.4/glib-2.0/schemas/org.gtk.gtk4.Settings.FileChooser.gschema.xml
/nix/store/k3i7m5ch2b250jd4q214gx5rraaqlaid-gtk+3-3.24.38/share/gsettings-schemas/gtk+3-3.24.38/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml
/nix/store/jswnsgpzzl9k2nrh2155jrryzd5ifln7-gtk4-4.10.4/share/gsettings-schemas/gtk4-4.10.4/glib-2.0/schemas/org.gtk.gtk4.Settings.FileChooser.gschema.xml
/nix/store/5pzqljy5fy7rsbrxicrqdlz3hvb25jhr-gtk+3-3.24.38/share/gsettings-schemas/gtk+3-3.24.38/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml
/nix/store/5gdc4xw769fg44f7wp6yxhrhc3n99frh-gtk4-4.12.3/share/gsettings-schemas/gtk4-4.12.3/glib-2.0/schemas/org.gtk.gtk4.Settings.FileChooser.gschema.xml
/nix/store/b58rkvfpkhw66jj6njc5d5xw6hyywfly-gtk+3-3.24.38/share/gsettings-schemas/gtk+3-3.24.38/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml
/nix/store/2x3zx0jyna3isnhvbq2s9xlhdn4jhdz0-gtk4-4.12.3/share/gsettings-schemas/gtk4-4.12.3/glib-2.0/schemas/org.gtk.gtk4.Settings.FileChooser.gschema.xml
/nix/store/zidry78k7kjxd7cpxvj4pqcklsfdh9li-xdg-desktop-portal-1.18.2/share/dbus-1/interfaces/org.freedesktop.impl.portal.FileChooser.xml
/nix/store/zidry78k7kjxd7cpxvj4pqcklsfdh9li-xdg-desktop-portal-1.18.2/share/dbus-1/interfaces/org.freedesktop.portal.FileChooser.xml
/nix/store/g4cjh6i91sy02sn50h414x77yrbzrrig-gtk+3-3.24.38/share/gsettings-schemas/gtk+3-3.24.38/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml

looks like it’s in gtk4.

Yeah, hopefully someone more experienced than I will chime in, but my best guess is that you need to get the dev output somehow? Nixpkgs 23.11 manual | Nix & NixOS

Also wondering if you need glib in your inputs, so it has access to gtk4?

I also added glib to nativeBuildInputs. Still getting the error.

Ok, I followed this post and executed

rm -rf ~/.local/share/glib-2.0/schemas

with

mkdir -p ~/.local/share/glib-2.0/schemas
cp -pi /nix/store/...-gtk+3-3.<LATEST>/share/gsettings-schemas/gtk+3-3.*/glib-2.0/schemas/gschemas.compiled ~/.local/share/glib-2.0/schema/

as the next step but with gtk4 instead of gtk+3.3.
Now I’m getting

(flakeshot:72854): GLib-GIO-ERROR **: 12:48:00.442: No GSettings schemas are installed on the system

You need to add wrapGAppsHook4 to your nativeBuildInputs.

Added but I’m still getting

(flakeshot:72854): GLib-GIO-ERROR **: 12:48:00.442: No GSettings schemas are installed on the system```

The GNOME section of the Nixpkgs manual explains what you need, in this case it is adding appropriate paths to XDG_DATA_DIRS environment variable. wrapGAppsHook4 does do this correctly but only for built derivations, not devShells, so it will not help you with cargo run.

There is no mechanism for shells at the moment, you will need to apply a hack like shellHook from Python + Qt woes - #2 by jtojnar with gappsWrapperArgs instead of qtWrapperArgs if you want to make it work.


Do not do that, it will break GTK programs if the schema is ever updated.

damn… thank you for your answer!