1{ lib, stdenv, rustPlatform, fetchFromGitHub, pkg-config, makeWrapper, vulkan-loader, QuartzCore }:
2
3rustPlatform.buildRustPackage rec {
4 pname = "wgpu-utils";
5 version = "0.16.1";
6
7 src = fetchFromGitHub {
8 owner = "gfx-rs";
9 repo = "wgpu";
10 rev = "v${version}";
11 hash = "sha256-tGjjjQDcN9zkxQSOrW/D1Pu6cycTKo/lh71mTEpZQIE=";
12 };
13
14 cargoLock = {
15 lockFile = ./Cargo.lock;
16 outputHashes = {
17 "d3d12-0.6.0" = "sha256-xCazXUriIQWMVa3DOI1aySBATmYwyDqsVYULRV2l/44=";
18 "naga-0.12.0" = "sha256-EZ8ZKixOFPT9ZTKIC/UGh2B3F09ENbCTUi+ASamJzMM=";
19 };
20 };
21
22 nativeBuildInputs = [
23 pkg-config
24 makeWrapper
25 ];
26
27 buildInputs = lib.optional stdenv.isDarwin QuartzCore;
28
29 # Tests fail, as the Nix sandbox doesn't provide an appropriate adapter (e.g. Vulkan).
30 doCheck = false;
31
32 postInstall = ''
33 wrapProgram $out/bin/wgpu-info \
34 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ vulkan-loader ]}
35 '';
36
37 meta = with lib; {
38 description = "Safe and portable GPU abstraction in Rust, implementing WebGPU API.";
39 homepage = "https://wgpu.rs/";
40 license = with licenses; [ asl20 /* or */ mit ];
41 maintainers = with maintainers; [ erictapen ];
42 mainProgram = "wgpu-info";
43 };
44}