nixpkgs/pkgs/by-name/dx/dxvk_1/package.nix
2023-10-08 16:10:33 -04:00

58 lines
1.6 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ lib
, stdenv
, fetchFromGitHub
, glslang
, meson
, ninja
, windows
, pkgsBuildHost
, enableMoltenVKCompat ? false
}:
let
isCross = stdenv.hostPlatform != stdenv.targetPlatform;
in
stdenv.mkDerivation (finalAttrs: {
pname = "dxvk";
version = "1.10.3";
src = fetchFromGitHub {
owner = "doitsujin";
repo = "dxvk";
rev = "v${finalAttrs.version}";
hash = "sha256-T93ZylxzJGprrP+j6axZwl2d3hJowMCUOKNjIyNzkmE=";
};
# These patches are required when using DXVK with Wine on Darwin.
patches = lib.optionals enableMoltenVKCompat [
# Patch DXVK to work with MoltenVK even though it doesnt support some required features.
# Some games work poorly (particularly Unreal Engine 4 games), but others work pretty well.
./darwin-dxvk-compat.patch
# Use synchronization primitives from the C++ standard library to avoid deadlocks on Darwin.
# See: https://www.reddit.com/r/macgaming/comments/t8liua/comment/hzsuce9/
./darwin-thread-primitives.patch
];
nativeBuildInputs = [ glslang meson ninja ];
buildInputs = [ windows.pthreads ];
mesonFlags =
let
arch = if stdenv.is32bit then "32" else "64";
in
[
"--buildtype" "release"
"--prefix" "${placeholder "out"}"
]
++ lib.optionals isCross [ "--cross-file" "build-win${arch}.txt" ];
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;
};
})