PolyMeilex / rfd

Rusty File Dialog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

a list of system dependencies

Redhawk18 opened this issue · comments

I built my iced app on nixos, however when trying to create a rfd window. Some of the gtk3 dependencies are missing because I get this error

GLib-GIO-ERROR **: 15:05:49.211: No GSettings schemas are installed on the system
--
Trace/breakpoint trap (core dumped)

a full list would be nice

For others experiencing this issue, here's a flake.nix file that appears to fix this issue on my end:

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let pkgs = import nixpkgs { inherit system; };
      in {
        devShells.default = pkgs.mkShell rec {
          nativeBuildInputs = with pkgs; [ cmake pkg-config wrapGAppsHook ];

          buildInputs = with pkgs; [
            xorg.libX11
            xorg.libXrandr
            xorg.libXcursor
            xorg.libXi
            libxkbcommon
            libGL
            fontconfig
            wayland
            gdk-pixbuf
            cairo
            pango
            atk
            gtk3
            gsettings-desktop-schemas
          ];

          LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath buildInputs;
          shellHook = ''
            export XDG_DATA_DIRS=${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS
          '';
        };
      });
}

@PolyMeilex I definitely don't understand much about the problem, but in doing some digging it looks like the way NixOS operates when it comes to gsettings schemas requires a bit of extra care in the environment variables:

https://discourse.nixos.org/t/custom-gsettings-schema-being-ignored-in-xdg-data-dirs/3449

The flake.nix file I shared was cobbled together after playing around with various cargo builds. When I bumped into @Redhawk18's specific problem then I added the shell hook portion at the bottom.

https://docs.rs/rfd/latest/rfd/#gtk-backend doesn't specify a version. Right now using cargo-deb in my Cargo.toml file I have (some parts elided):

[dependencies]
rfd = { version = "0.14", default-features = false, features = ["xdg-portal", "tokio"] }

[package.metadata.deb]
depends = "$auto, xdg-desktop-portal-kde (>= 5.27.5-2) | xdg-desktop-portal-gtk (>= 1.14.1-1) | xdg-desktop-portal-gnome (>= 43.1-2)"

This is probably wrong, but the best that I know.