2022-03-10 19:12:11 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, glslang
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
, windows
|
|
|
|
, src
|
|
|
|
, version
|
2022-12-28 21:21:41 +00:00
|
|
|
, spirv-headers
|
|
|
|
, vulkan-headers
|
2022-03-10 19:12:11 +00:00
|
|
|
, dxvkPatches
|
|
|
|
}:
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
let
|
|
|
|
# DXVK 2.0+ no longer vendors certain dependencies. This derivation also needs to build on Darwin,
|
|
|
|
# which does not currently support DXVK 2.0, so adapt conditionally for this situation.
|
|
|
|
isDxvk2 = lib.versionAtLeast version "2.0";
|
|
|
|
in
|
2022-03-10 19:12:11 +00:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "dxvk";
|
|
|
|
inherit src version;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ glslang meson ninja ];
|
2022-12-28 21:21:41 +00:00
|
|
|
buildInputs = [ windows.pthreads ]
|
|
|
|
++ lib.optionals isDxvk2 [ spirv-headers vulkan-headers ];
|
2022-03-10 19:12:11 +00:00
|
|
|
|
|
|
|
patches = dxvkPatches;
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
preConfigure = lib.optionalString isDxvk2 ''
|
|
|
|
ln -s ${lib.getDev spirv-headers}/include include/spirv/include
|
|
|
|
ln -s ${lib.getDev vulkan-headers}/include include/vulkan/include
|
|
|
|
'';
|
|
|
|
|
2022-03-10 19:12:11 +00:00
|
|
|
mesonFlags =
|
|
|
|
let
|
|
|
|
arch = if stdenv.is32bit then "32" else "64";
|
|
|
|
in
|
|
|
|
[
|
|
|
|
"--buildtype" "release"
|
|
|
|
"--cross-file" "build-win${arch}.txt"
|
|
|
|
"--prefix" "${placeholder "out"}"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A Vulkan-based translation layer for Direct3D 9/10/11";
|
|
|
|
homepage = "https://github.com/doitsujin/dxvk";
|
|
|
|
changelog = "https://github.com/doitsujin/dxvk/releases";
|
|
|
|
maintainers = [ lib.maintainers.reckenrode ];
|
|
|
|
license = lib.licenses.zlib;
|
|
|
|
platforms = lib.platforms.windows;
|
|
|
|
};
|
|
|
|
}
|