63 lines
1.3 KiB
Nix
63 lines
1.3 KiB
Nix
|
|
{
|
||
|
|
lib,
|
||
|
|
stdenv,
|
||
|
|
fetchFromGitHub,
|
||
|
|
rustPlatform,
|
||
|
|
fixDarwinDylibNames,
|
||
|
|
vulkan-loader,
|
||
|
|
nix-update-script,
|
||
|
|
callPackage,
|
||
|
|
}:
|
||
|
|
|
||
|
|
rustPlatform.buildRustPackage rec {
|
||
|
|
pname = "wgpu-native";
|
||
|
|
version = "25.0.2.2";
|
||
|
|
|
||
|
|
src = fetchFromGitHub {
|
||
|
|
owner = "gfx-rs";
|
||
|
|
repo = "wgpu-native";
|
||
|
|
tag = "v${version}";
|
||
|
|
hash = "sha256-ihA1pfTW6EHpihL4IUv7YTsU1SLkxEM6wUDr7NiHmLc=";
|
||
|
|
fetchSubmodules = true;
|
||
|
|
};
|
||
|
|
|
||
|
|
outputs = [
|
||
|
|
"out"
|
||
|
|
"dev"
|
||
|
|
];
|
||
|
|
|
||
|
|
cargoHash = "sha256-8Axm9gIX6yW0ScV5SjB6AWlmlIeGuQYonWsGwcIH2os=";
|
||
|
|
|
||
|
|
nativeBuildInputs = [
|
||
|
|
rustPlatform.bindgenHook
|
||
|
|
]
|
||
|
|
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
||
|
|
|
||
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
|
||
|
|
vulkan-loader
|
||
|
|
];
|
||
|
|
|
||
|
|
postInstall = ''
|
||
|
|
rm $out/lib/libwgpu_native.a
|
||
|
|
install -Dm644 ./ffi/wgpu.h -t $dev/include/webgpu
|
||
|
|
install -Dm644 ./ffi/webgpu-headers/webgpu.h -t $dev/include/webgpu
|
||
|
|
'';
|
||
|
|
|
||
|
|
passthru = {
|
||
|
|
updateScript = nix-update-script { };
|
||
|
|
examples = callPackage ./examples.nix {
|
||
|
|
inherit version src;
|
||
|
|
};
|
||
|
|
};
|
||
|
|
|
||
|
|
meta = {
|
||
|
|
description = "Native WebGPU implementation based on wgpu-core";
|
||
|
|
homepage = "https://github.com/gfx-rs/wgpu-native";
|
||
|
|
license = with lib.licenses; [
|
||
|
|
mit
|
||
|
|
asl20
|
||
|
|
];
|
||
|
|
maintainers = with lib.maintainers; [ niklaskorz ];
|
||
|
|
};
|
||
|
|
}
|