nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 pkg-config,
6 cmake,
7 makeWrapper,
8 vulkan-loader,
9 freetype,
10 fontconfig,
11}:
12
13rustPlatform.buildRustPackage rec {
14 pname = "wgpu-utils";
15 version = "25.0.2";
16
17 src = fetchFromGitHub {
18 owner = "gfx-rs";
19 repo = "wgpu";
20 tag = "wgpu-v${version}";
21 hash = "sha256-Na8UWMEzY0mvw8YERZ86PH79Z5YlXITPdOYha7Ahn7k=";
22 };
23
24 cargoHash = "sha256-9o1Tb0pVTc3iWPjNlAPBQX72djcx3EPJhxuUW6xZfCs=";
25
26 nativeBuildInputs = [
27 pkg-config
28 cmake
29 makeWrapper
30 ];
31
32 buildInputs = [
33 freetype
34 fontconfig
35 ];
36
37 # Tests fail, as the Nix sandbox doesn't provide an appropriate adapter (e.g. Vulkan).
38 doCheck = false;
39
40 postInstall = ''
41 wrapProgram $out/bin/wgpu-info \
42 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ vulkan-loader ]}
43 '';
44
45 meta = {
46 description = "Safe and portable GPU abstraction in Rust, implementing WebGPU API";
47 homepage = "https://wgpu.rs/";
48 license = with lib.licenses; [
49 asl20 # or
50 mit
51 ];
52 maintainers = with lib.maintainers; [ erictapen ];
53 mainProgram = "wgpu-info";
54 };
55}