16 sdl2Support ? (!stdenv.hostPlatform.isWindows),
17 glfwSupport ? (!stdenv.hostPlatform.isWindows),
20 assert stdenv.hostPlatform.isWindows -> !glfwSupport && !sdl2Support;
23 inherit (stdenv) hostPlatform;
25 libPrefix = lib.optionalString (!hostPlatform.isWindows) "lib";
28 if hostPlatform.isDarwin then
29 ".${version}${hostPlatform.extensions.sharedLibrary}"
30 else if hostPlatform.isWindows then
31 hostPlatform.extensions.sharedLibrary
33 "${hostPlatform.extensions.sharedLibrary}.${version}";
35 libglfw = "${libPrefix}glfw${soVersion "3"}";
36 libSDL2 = "${libPrefix}SDL2${lib.optionalString (!hostPlatform.isWindows) "-2.0"}${soVersion "0"}";
38 stdenv.mkDerivation (finalAttrs: {
42 src = fetchFromGitHub {
45 rev = "v${finalAttrs.version}";
46 hash = "sha256-4U0Z1oR0BKIHZ6YNT/+8sFe2I/ZKmPecInMXUho4MHg=";
47 fetchSubmodules = true; # Needed for the DirectX headers and libdisplay-info
52 substituteInPlace meson.build \
53 --replace-fail "dependency('glfw'" "dependency('glfw3'"
54 substituteInPlace subprojects/libdisplay-info/tool/gen-search-table.py \
55 --replace-fail "/usr/bin/env python3" "${lib.getBin pkgsBuildHost.python3}/bin/python3"
57 + lib.optionalString glfwSupport ''
58 substituteInPlace src/wsi/glfw/wsi_platform_glfw.cpp \
59 --replace-fail '${libglfw}' '${lib.getLib glfw}/lib/${libglfw}'
61 + lib.optionalString sdl2Support ''
62 substituteInPlace src/wsi/sdl2/wsi_platform_sdl2.cpp \
63 --replace-fail '${libSDL2}' '${lib.getLib SDL2}/lib/${libSDL2}'
72 ] ++ lib.optionals (glfwSupport || sdl2Support) [ pkg-config ];
79 ++ lib.optionals sdl2Support [ SDL2 ]
80 ++ lib.optionals glfwSupport [ glfw ]
81 ++ lib.optionals hostPlatform.isWindows [ windows.pthreads ];
83 # Build with the Vulkan SDK in nixpkgs.
85 rm -rf include/spirv/include include/vulkan/include
86 mkdir -p include/spirv/include include/vulkan/include
89 mesonBuildType = "release";
93 passthru.updateScript = gitUpdater { rev-prefix = "v"; };
95 __structuredAttrs = true;
98 description = "Vulkan-based translation layer for Direct3D 8/9/10/11";
99 homepage = "https://github.com/doitsujin/dxvk";
100 changelog = "https://github.com/doitsujin/dxvk/releases";
101 maintainers = [ lib.maintainers.reckenrode ];
102 license = lib.licenses.zlib;
103 badPlatforms = lib.platforms.darwin;
104 platforms = lib.platforms.windows ++ lib.platforms.unix;