I came across https://bevyengine.org/ , a game engine in Rust and I want to run their example in NixOS. I am able to compile their example, a reproducible repo with flake support available here for testing:
But right now I am getting this error, despite I am using X11. How can I fix this?
I had something similar with another game engine I wanted to try.
IIRC it was because the library responsible for dynamic loading of drivers used hardcoded pathes.
Back then I didn’t have the time and energy to go deeper than that or even trying to fix, as I wouldn’t have known a portable way to fix it either…
Perhaps you are affected by the same problem?
Check winit and follow how it’s loading the libs.
That’s the biggest learning hurdle in NixOS. By default, nothing knows where to find the packages in you the nix store, you must “expose” it within a shell or nix build.
For libX11.so.6, you want the xorg.libX11
$ nix-locate libX11.so.6 --top-level
remarkable2-toolchain.out 0 s /nix/store/niwh39q61h6s7c127zf0a7291ajjzc6j-remarkable2-toolchain-3.1.2/sysroots/x86_64-codexsdk-linux/usr/lib/libX11.so.6
remarkable2-toolchain.out 1,285,512 x /nix/store/niwh39q61h6s7c127zf0a7291ajjzc6j-remarkable2-toolchain-3.1.2/sysroots/x86_64-codexsdk-linux/usr/lib/libX11.so.6.3.0
remarkable-toolchain.out 0 s /nix/store/597yy4hjagq973c07cr347ms84hhq1qw-remarkable-toolchain-3.1.2/sysroots/x86_64-codexsdk-linux/usr/lib/libX11.so.6
remarkable-toolchain.out 1,285,512 x /nix/store/597yy4hjagq973c07cr347ms84hhq1qw-remarkable-toolchain-3.1.2/sysroots/x86_64-codexsdk-linux/usr/lib/libX11.so.6.3.0
nxproxy.out 0 s /nix/store/xr23g4180gb1fvwwcx8kpkdd84fixka3-nx-libs-3.5.99.26/lib/nx/X11/libX11.so.6
nxproxy.out 0 s /nix/store/xr23g4180gb1fvwwcx8kpkdd84fixka3-nx-libs-3.5.99.26/lib/nx/X11/libX11.so.6.3.0
xlibs.libX11.out 0 s /nix/store/avqk9invc40jg7sh57y0nmpnccz5nm1d-libX11-1.7.2/lib/libX11.so.6
xlibs.libX11.out 1,433,520 x /nix/store/avqk9invc40jg7sh57y0nmpnccz5nm1d-libX11-1.7.2/lib/libX11.so.6.4.0
I thought I am fine already as I am using X11 on my machine already? I thought direnv will just change $PATH, I didn’t realize it will hide shared objects as well
@Greizgh I have tried to add more deps there, but still I am hitting the same error. can you try and run this one your end and see if you can find anything?
run with cargo run --example breakout
I can confirm that by adding in those dependencies I have fixed that error, but got a new one down below
2022-02-03T22:32:28.770646Z INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 2.3333333333333335
thread 'main' panicked at 'Unable to find a GPU! Make sure you have installed required drivers!', crates/bevy_render/src/renderer/mod.rs:74:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace