Rust code using bracket-lib library on wayland - problem

I am working through the excellent Hands On Rust book. This teaches rust programming through the medium of game development. The initial chapters use bracket-lib as a game engine. I am using my NixOS laptop for this task, which is running unstable plasma6, under wayland.

When I cargo run the simple example, I get the following errors:

Failed to initialize any backend! Wayland status: NoWaylandLib X11 status: LibraryOpenError(Op
enError { kind: Library, detail: “opening library failed (libX11.so.6: cannot open shared obje
ct file: No such file or directory); opening library failed (libX11.so: cannot open shared obj
ect file: No such file or directory)” })

I suspect I need to add something to my devshell flake, but I am not sure what is missing and would appreciate any tips!

The flake looks like this currently:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    rust-overlay = {
      url = "github:oxalica/rust-overlay";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        flake-utils.follows = "flake-utils";
      };
    };
  };
  outputs = { self, nixpkgs, flake-utils, rust-overlay }: 
    flake-utils.lib.eachDefaultSystem 
      (system:
        let
          overlays = [ (import rust-overlay) ];
          pkgs = import nixpkgs {
            inherit system overlays;
          };
          rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
        in 
        with pkgs;
        {
          devShells.default = mkShell {
            buildInputs = [ 
              rustToolchain
              cmake
              pkg-config
              fontconfig
            ];
          };
        }
      );
}

Thanks for reading.

I’m experiencing the same issue…were you able to resolve this?