Hello guys! I’m getting into rust game development and I want to setup an environment to run the examples from the bevy game engine.
Right now, I got to this shell.nix:
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = with pkgs; [
gcc
libGL
pkg-config
wayland
alsa-lib
cargo
openssl
libudev-zero
libxkbcommon
];
LD_LIBRARY_PATH="${pkgs.libGL}/lib";
}
Having setup direnv, with echo “use nix > .envrc” then direnv allow, I get to a shell in which I can run the basic one:
$ cargo run --example hello_world
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.30s
Running `target/debug/examples/hello_world`
hello world
However, running the 2D Bloom example gives me errors:
$ cargo run --example bloom_2d
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.29s
Running `target/debug/examples/bloom_2d`
2026-01-31T20:38:23.175965Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux (NixOS 26.05)", kernel: "6.12.67", cpu: "AMD Ryzen 5 7535U with Radeon Graphics", core_count: "6", memory: "14.4 GiB" }
2026-01-31T20:38:23.184384Z INFO xkbcommon_dl: Failed loading `libxkbcommon.so.0`. Error: CantOpen(DlOpen { desc: "libxkbcommon.so.0: cannot open shared object file: No such file or directory" })
2026-01-31T20:38:23.184441Z INFO xkbcommon_dl: Failed loading `libxkbcommon.so`. Error: CantOpen(DlOpen { desc: "libxkbcommon.so: cannot open shared object file: No such file or directory" })
thread 'main' (31296) panicked at /home/bernborgess/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/winit-0.30.12/src/platform_impl/linux/wayland/seat/keyboard/mod.rs:300:41:
called `Result::unwrap()` on an `Err` value: XKBNotFound
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Note that I added libxkbcommon to the buildInputs after the error, but the issue persists. Any pointers at this stage?
