bevyengine / bevyengine/bevy

bevy/dynamic feature doesn't find vulkan-loader on NixOS

Open
#1,992 11 comments 0 reactions 0 assignees View on GitHub
C-Bug O-Linux
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version

Bevy main branch (https://github.com/bevyengine/bevy#e3fb23d4d3828842ab5780d1200b231a7e9549ea)

## Operating system & version

NixOS unstable w/ flakes

## What you did

Setup my project using the build.rs in #136
I'm using nix flakes so:
`nix develop` (get build environment)
`cargo run --features bevy/dynamic`

## What you expected to happen

The brick breaker example to run

## What actually happened

```
thread 'main' panicked at 'Unable to find a GPU! Make sure you have installed required drivers!'
```
Same error when I was fixing the previous error for static building where it didn't link against vulkan & x11

## Additional information

It works if I don't do `--features bevy/dynamic` but the compile time is slow

My flake.nix: (using naersk and fenix to get rust nightly)
```nix
{
inputs = {
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nmattia/naersk";
fenix.url = "github:nix-community/fenix";
};

outputs = { self, nixpkgs, utils, naersk, fenix }:
utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages."${system}";
# Specify Rust Toolchain
# Use Stable (Default)
# naersk-lib = naersk.lib."${system}";
# Use Nightly (provided by fenix)
naersk-lib = naersk.lib."${system}".override {
# Use Fenix to get nightly rust
inherit (fenix.packages.${system}.minimal) cargo rustc;
};
in rec {
# `nix build`
packages.ray_game = naersk-lib.buildPackage {
pname = "ray_game";
root = ./.;
buildInputs = with pkgs; [
# Package location
pkgconfig
# Window and Input
x11
xorg.libXcursor
xorg.libXrandr
xorg.libXi

# Vulkan
vulkan-tools
vulkan-headers
vulkan-loader
vulkan-validation-layers
alsaLib # Sound support
libudev # device management
lld # fast linker
];
};
defaultPackage = packages.ray_game;

# `nix run`
apps.ray_game = utils.lib.mkApp {
drv = packages.ray_game;
};
defaultApp = apps.ray_game;

# `nix develop`
devShell = pkgs.mkShell {
buildInputs = packages.ray_game.buildInputs;
};
});
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with the build.rs setup from #136, the supplied flake.nix, and `cargo run --features bevy/dynamic` on NixOS. Investigate how the dynamic feature locates the Vulkan loader, compare it with the working static build, and verify that the brick breaker example runs successfully with the dynamic feature.

Written by the indexing model from the issue text.

Assessment

Tech stack
nixos, rust
Domain
build-system, computer-graphics, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.