Hey, im on NixOs and this is my system pretty much GitHub - Astodialo/.dotfiles: ma stuff I’m trying to build a Rust project with Nannou as a dependency. I’m doing that inside devshell created from this flake { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - Pastebin.com
When I do cargo run, I get a screen pop up and close immediately and then get the error could not build default app window: NoAvailableAdapter
This is an issue that stems from wgpu itself, not nannou per se. wgpu include a shell.nix file in their repo which you can use (link). Just don’t forget to also copy the rust-toolchain.toml file if you decide to use their shell.nix.
In my case, I like using flakes, a system-wide installation of Rust, and the 25.05 stable channel so I slightly modified their script.
Here is my flake.nix (no rust-toolchain.toml is required):
{
description = "Basic wgpu setup";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
};
outputs = { self, nixpkgs }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
{
devShells."x86_64-linux".default =
let
deps = with pkgs; [
# necessary for building wgpu in 3rd party packages (in most cases)
libxkbcommon
wayland xorg.libX11 xorg.libXcursor xorg.libXrandr xorg.libXi
alsa-lib
fontconfig freetype
shaderc directx-shader-compiler
pkg-config cmake
mold # could use any linker, needed for rustix (but mold is fast)
libGL
vulkan-headers vulkan-loader
vulkan-tools vulkan-tools-lunarg
vulkan-extension-layer
vulkan-validation-layers # don't need them *strictly* but immensely helpful
# necessary for developing (all of) wgpu itself
cargo-nextest cargo-fuzz
# nice for developing wgpu itself
typos
# nice tools
gdb rr
evcxr
valgrind
renderdoc
];
in
pkgs.mkShell {
packages = deps;
shellHook = ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${builtins.toString (pkgs.lib.makeLibraryPath deps)}";
'';
};
};
}