Merge pull request #259836 from reckenrode/dxvk-by-name

dxvk: migrate to by-name

authored by

Weijia Wang and committed by
GitHub
253b7c66 badea05e

+134 -118
+57
pkgs/by-name/dx/dxvk_1/package.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , glslang 5 + , meson 6 + , ninja 7 + , windows 8 + , pkgsBuildHost 9 + , enableMoltenVKCompat ? false 10 + }: 11 + 12 + let 13 + isCross = stdenv.hostPlatform != stdenv.targetPlatform; 14 + in 15 + stdenv.mkDerivation (finalAttrs: { 16 + pname = "dxvk"; 17 + version = "1.10.3"; 18 + 19 + src = fetchFromGitHub { 20 + owner = "doitsujin"; 21 + repo = "dxvk"; 22 + rev = "v${finalAttrs.version}"; 23 + hash = "sha256-T93ZylxzJGprrP+j6axZwl2d3hJowMCUOKNjIyNzkmE="; 24 + }; 25 + 26 + # These patches are required when using DXVK with Wine on Darwin. 27 + patches = lib.optionals enableMoltenVKCompat [ 28 + # Patch DXVK to work with MoltenVK even though it doesn’t support some required features. 29 + # Some games work poorly (particularly Unreal Engine 4 games), but others work pretty well. 30 + ./darwin-dxvk-compat.patch 31 + # Use synchronization primitives from the C++ standard library to avoid deadlocks on Darwin. 32 + # See: https://www.reddit.com/r/macgaming/comments/t8liua/comment/hzsuce9/ 33 + ./darwin-thread-primitives.patch 34 + ]; 35 + 36 + nativeBuildInputs = [ glslang meson ninja ]; 37 + buildInputs = [ windows.pthreads ]; 38 + 39 + mesonFlags = 40 + let 41 + arch = if stdenv.is32bit then "32" else "64"; 42 + in 43 + [ 44 + "--buildtype" "release" 45 + "--prefix" "${placeholder "out"}" 46 + ] 47 + ++ lib.optionals isCross [ "--cross-file" "build-win${arch}.txt" ]; 48 + 49 + meta = { 50 + description = "A Vulkan-based translation layer for Direct3D 9/10/11"; 51 + homepage = "https://github.com/doitsujin/dxvk"; 52 + changelog = "https://github.com/doitsujin/dxvk/releases"; 53 + maintainers = [ lib.maintainers.reckenrode ]; 54 + license = lib.licenses.zlib; 55 + platforms = lib.platforms.windows; 56 + }; 57 + })
+77
pkgs/by-name/dx/dxvk_2/package.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , pkgsBuildHost 5 + , glslang 6 + , meson 7 + , ninja 8 + , windows 9 + , spirv-headers 10 + , vulkan-headers 11 + , SDL2 12 + , glfw 13 + , gitUpdater 14 + , sdl2Support ? true 15 + , glfwSupport ? false 16 + }: 17 + 18 + # SDL2 and GLFW support are mutually exclusive. 19 + assert !sdl2Support || !glfwSupport; 20 + 21 + let 22 + isCross = stdenv.hostPlatform != stdenv.targetPlatform; 23 + isWindows = stdenv.hostPlatform.uname.system == "Windows"; 24 + in 25 + stdenv.mkDerivation (finalAttrs: { 26 + pname = "dxvk"; 27 + version = "2.3"; 28 + 29 + src = fetchFromGitHub { 30 + owner = "doitsujin"; 31 + repo = "dxvk"; 32 + rev = "v${finalAttrs.version}"; 33 + hash = "sha256-RU+B0XfphD5HHW/vSzqHLUaGS3E31d5sOLp3lMmrCB8="; 34 + fetchSubmodules = true; # Needed for the DirectX headers and libdisplay-info 35 + }; 36 + 37 + postPatch = '' 38 + substituteInPlace "subprojects/libdisplay-info/tool/gen-search-table.py" \ 39 + --replace "/usr/bin/env python3" "${lib.getBin pkgsBuildHost.python3}/bin/python3" 40 + ''; 41 + 42 + nativeBuildInputs = [ glslang meson ninja ]; 43 + buildInputs = [ spirv-headers vulkan-headers ] 44 + ++ lib.optionals (!isWindows && sdl2Support) [ SDL2 ] 45 + ++ lib.optionals (!isWindows && glfwSupport) [ glfw ] 46 + ++ lib.optionals isWindows [ windows.pthreads ]; 47 + 48 + # Build with the Vulkan SDK in nixpkgs. 49 + preConfigure = '' 50 + rm -rf include/spirv/include include/vulkan/include 51 + mkdir -p include/spirv/include include/vulkan/include 52 + ''; 53 + 54 + mesonFlags = 55 + let 56 + arch = if stdenv.is32bit then "32" else "64"; 57 + in 58 + [ 59 + "--buildtype" "release" 60 + "--prefix" "${placeholder "out"}" 61 + ] 62 + ++ lib.optionals isCross [ "--cross-file" "build-win${arch}.txt" ] 63 + ++ lib.optional glfwSupport "-Ddxvk_native_wsi=glfw"; 64 + 65 + doCheck = !isCross; 66 + 67 + passthru.updateScript = gitUpdater { rev-prefix = "v"; }; 68 + 69 + meta = { 70 + description = "A Vulkan-based translation layer for Direct3D 9/10/11"; 71 + homepage = "https://github.com/doitsujin/dxvk"; 72 + changelog = "https://github.com/doitsujin/dxvk/releases"; 73 + maintainers = [ lib.maintainers.reckenrode ]; 74 + license = lib.licenses.zlib; 75 + platforms = lib.platforms.windows ++ lib.platforms.linux; 76 + }; 77 + })
pkgs/misc/dxvk/darwin-dxvk-compat.patch pkgs/by-name/dx/dxvk_1/darwin-dxvk-compat.patch
pkgs/misc/dxvk/darwin-thread-primitives.patch pkgs/by-name/dx/dxvk_1/darwin-thread-primitives.patch
pkgs/misc/dxvk/default.nix pkgs/by-name/dx/dxvk/package.nix
-114
pkgs/misc/dxvk/dxvk.nix
··· 1 - { lib 2 - , stdenv 3 - , fetchFromGitHub 4 - , glslang 5 - , meson 6 - , ninja 7 - , windows 8 - , dxvkVersion ? "default" 9 - , spirv-headers 10 - , vulkan-headers 11 - , SDL2 12 - , glfw 13 - , pkgsBuildHost 14 - , gitUpdater 15 - , sdl2Support ? true 16 - , glfwSupport ? false 17 - , enableMoltenVKCompat ? false 18 - }: 19 - 20 - # SDL2 and GLFW support are mutually exclusive. 21 - assert !sdl2Support || !glfwSupport; 22 - 23 - let 24 - # DXVK 2.0+ no longer vendors certain dependencies. This derivation also needs to build on Darwin, 25 - # which does not currently support DXVK 2.0, so adapt conditionally for this situation. 26 - isDxvk2 = lib.versionAtLeast (srcs.${dxvkVersion}.version) "2.0"; 27 - 28 - # DXVK has effectively the same build script regardless of platform. 29 - srcs = { 30 - "1.10" = rec { 31 - version = "1.10.3"; 32 - src = fetchFromGitHub { 33 - owner = "doitsujin"; 34 - repo = "dxvk"; 35 - rev = "v${version}"; 36 - hash = "sha256-T93ZylxzJGprrP+j6axZwl2d3hJowMCUOKNjIyNzkmE="; 37 - }; 38 - # These patches are required when using DXVK with Wine on Darwin. 39 - patches = lib.optionals enableMoltenVKCompat [ 40 - # Patch DXVK to work with MoltenVK even though it doesn’t support some required features. 41 - # Some games work poorly (particularly Unreal Engine 4 games), but others work pretty well. 42 - ./darwin-dxvk-compat.patch 43 - # Use synchronization primitives from the C++ standard library to avoid deadlocks on Darwin. 44 - # See: https://www.reddit.com/r/macgaming/comments/t8liua/comment/hzsuce9/ 45 - ./darwin-thread-primitives.patch 46 - ]; 47 - }; 48 - "default" = rec { 49 - version = "2.3"; 50 - src = fetchFromGitHub { 51 - owner = "doitsujin"; 52 - repo = "dxvk"; 53 - rev = "v${version}"; 54 - hash = "sha256-RU+B0XfphD5HHW/vSzqHLUaGS3E31d5sOLp3lMmrCB8="; 55 - fetchSubmodules = true; # Needed for the DirectX headers and libdisplay-info 56 - }; 57 - patches = [ ]; 58 - }; 59 - }; 60 - 61 - isWindows = stdenv.targetPlatform.uname.system == "Windows"; 62 - isCross = stdenv.hostPlatform != stdenv.targetPlatform; 63 - in 64 - stdenv.mkDerivation (finalAttrs: { 65 - pname = "dxvk"; 66 - inherit (srcs.${dxvkVersion}) version src patches; 67 - 68 - nativeBuildInputs = [ glslang meson ninja ]; 69 - buildInputs = lib.optionals isWindows [ windows.pthreads ] 70 - ++ lib.optionals isDxvk2 ( 71 - [ spirv-headers vulkan-headers ] 72 - ++ lib.optional (!isWindows && sdl2Support) SDL2 73 - ++ lib.optional (!isWindows && glfwSupport) glfw 74 - ); 75 - 76 - postPatch = lib.optionalString isDxvk2 '' 77 - substituteInPlace "subprojects/libdisplay-info/tool/gen-search-table.py" \ 78 - --replace "/usr/bin/env python3" "${lib.getBin pkgsBuildHost.python3}/bin/python3" 79 - ''; 80 - 81 - # Build with the Vulkan SDK in nixpkgs. 82 - preConfigure = '' 83 - rm -rf include/spirv/include include/vulkan/include 84 - mkdir -p include/spirv/include include/vulkan/include 85 - ''; 86 - 87 - mesonFlags = 88 - let 89 - arch = if stdenv.is32bit then "32" else "64"; 90 - in 91 - [ 92 - "--buildtype" "release" 93 - "--prefix" "${placeholder "out"}" 94 - ] 95 - ++ lib.optionals isCross [ "--cross-file" "build-win${arch}.txt" ] 96 - ++ lib.optional glfwSupport "-Ddxvk_native_wsi=glfw"; 97 - 98 - doCheck = isDxvk2 && !isCross; 99 - 100 - passthru = lib.optionalAttrs (lib.versionAtLeast finalAttrs.version "2.0") { 101 - updateScript = gitUpdater { 102 - rev-prefix = "v"; 103 - }; 104 - }; 105 - 106 - meta = { 107 - description = "A Vulkan-based translation layer for Direct3D 9/10/11"; 108 - homepage = "https://github.com/doitsujin/dxvk"; 109 - changelog = "https://github.com/doitsujin/dxvk/releases"; 110 - maintainers = [ lib.maintainers.reckenrode ]; 111 - license = lib.licenses.zlib; 112 - platforms = lib.platforms.windows ++ lib.optionals isDxvk2 lib.platforms.linux; 113 - }; 114 - })
pkgs/misc/dxvk/setup_dxvk.sh pkgs/by-name/dx/dxvk/setup_dxvk.sh
-4
pkgs/top-level/all-packages.nix
··· 40465 40465 40466 40466 dump = callPackage ../tools/backup/dump { }; 40467 40467 40468 - dxvk = callPackage ../misc/dxvk { }; 40469 - dxvk_1 = callPackage ../misc/dxvk/dxvk.nix { dxvkVersion = "1.10"; }; 40470 - dxvk_2 = callPackage ../misc/dxvk/dxvk.nix { }; 40471 - 40472 40468 ec2stepshell = callPackage ../tools/security/ec2stepshell { }; 40473 40469 40474 40470 ecdsatool = callPackage ../tools/security/ecdsatool { };