Getting bevy engine workining in a nix shell

I have seen many others with this same issue but none of their fixes have helped me so far. I’m trying to run Bevy Engine in a shell and it cannot find my gpu. I have every possible dependency I could find that is listed on bevy’s site and what I could find online (even tried nixGL and nixVulkan).

This is my current flake:

  description = "Rust dev shell for bevy based on zero to nix rust dev flake)";

  # Flake inputs
  inputs = {
    nixpkgs.url = "";
    rust-overlay.url = "github:oxalica/rust-overlay"; # A helper for Rust + Nix

  # Flake outputs
  outputs = { self, nixpkgs, rust-overlay }:
      # Overlays enable you to customize the Nixpkgs attribute set
      overlays = [
        # Makes a `rust-bin` attribute available in Nixpkgs
        (import rust-overlay)
        # Provides a `rustToolchain` attribute for Nixpkgs that we can use to
        # create a Rust environment
        (self: super: {
          rustToolchain = super.rust-bin.stable.latest.default;

      # Systems supported
      allSystems = [
        "x86_64-linux" # 64-bit Intel/AMD Linux
        "aarch64-linux" # 64-bit ARM Linux
        "x86_64-darwin" # 64-bit Intel macOS
        "aarch64-darwin" # 64-bit ARM macOS

      # Helper to provide system-specific attributes
      forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
        pkgs = import nixpkgs { inherit overlays system; };
      # Development environment output
      devShells = forAllSystems ({ pkgs }: {
        default = pkgs.mkShell {
          # The Nix packages provided in the environment
          packages = (with pkgs; [
            # Bevy
             # If on x11
             # If on wayland
            # Rust
          ]) ++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ libiconv ]);
          shellHook = ''
            export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath [

I made several Bevy projects a while back and made this as a scaffold: GitHub - polygon/bevy_nix_vscode_template: Starterkit for bevy projcts

Fair warning, it’s a few Bevy versions behind, since I didn’t have the time to work on my Bevy stuff recently. So it will likely require some re-working.

I added certain things that make working with Bevy (at that time) quite pain-free. For example, using mold for fast linking of incremental builds. So beware, this is a bit opinionated.

Bevy has Nix section in the official Linux dependencies docs and those seem to be sufficient for Bevy app to run for me on NixOS:

I am also adding mold for faster linking as recommended in

Though I do have some issues with cursors on Wayland I have not managed to fix yet, most likely due to the old smithay client-toolkit bevy uses:

WARN winit::platform_impl::platform::wayland::seat::pointer: Failed to set cursor to Default
ERROR sctk_adwaita::pointer: Failed to set cursor

hmm I trief that repo and still doesn’t seem to work i think I might just have a borked gpu config which does seem odd as I use the hardware config from nix-hardware but I’ll try doing some more stuff with that seen as I cant think of anything else thanks though!

Alright it works now! I was missing some dependencies and also had to use nixVulkanIntel my flake can be found here (there is some unneeded stuff in there aswell but it is marked as such)