How can I resolve this libwayland-client GLFW Wayland error?

I get this error on hyprland nixos when trying to launch a glfw application.

error: failed to initialize GLFW: Wayland: Failed to load libwayland-client

Here is my flake.nix:

{
  description = "";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    zig.url = "github:mitchellh/zig-overlay";
  };
  outputs = {nixpkgs, zig, ... } @ inputs:
    let
      system = "x86_64-linux";

      pkgs = import nixpkgs {
        inherit system;
        config.allowUnfree = true;
      };

      zigMaster = zig.packages.${system}.master;
    in
      {
        devShells.${system}.default = pkgs.mkShell {
          BuildInputs = with pkgs; [
            glfw-wayland
          ];
          nativeBuildInputs = [
            zigMaster
          ];
        };
      };
}

I really don’t know what’s causing this problem.

I tried to add wayland-protocols to the BuildInputs, but that doesn’t change anything.

have you solved this problem? I encountered the same issue.

buildInputs is spelled wrong here (it’s case-sensitive). There might be more issues to resolve as well.

for me the solution was to add this into my config

 shellHook = ''
          export LD_LIBRARY_PATH=${pkgs.wayland}/lib:$LD_LIBRARY_PATH
          '';

buildInputs is now empty

1 Like

Thank you💗 It works!!