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