forked from mirrors/nixpkgs
dxvk: expose Windows derivations
This is in preparation for native builds of DXVK, but it also allows users to choose to use an older version if that is more compatible with their hardware.
This commit is contained in:
parent
16e9b55025
commit
403fe21323
|
@ -1,62 +1,23 @@
|
||||||
{ lib
|
{ lib
|
||||||
, pkgs
|
|
||||||
, stdenvNoCC
|
, stdenvNoCC
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, pkgsCross
|
, pkgsCross
|
||||||
|
, stdenv
|
||||||
, bash
|
, bash
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation (finalAttrs:
|
stdenvNoCC.mkDerivation (finalAttrs:
|
||||||
let
|
let
|
||||||
system = lib.toLower stdenvNoCC.targetPlatform.uname.system;
|
dxvk32 = if stdenv.isDarwin then pkgsCross.mingw32.dxvk_1 else pkgsCross.mingw32.dxvk_2;
|
||||||
|
dxvk64 = if stdenv.isDarwin then pkgsCross.mingwW64.dxvk_1 else pkgsCross.mingwW64.dxvk_2;
|
||||||
# DXVK needs to be a separate derivation because it’s actually a set of DLLs for Windows that
|
|
||||||
# needs to be built with a cross-compiler.
|
|
||||||
dxvk32 = pkgsCross.mingw32.callPackage ./dxvk.nix {
|
|
||||||
inherit (finalAttrs) src version dxvkPatches;
|
|
||||||
};
|
|
||||||
dxvk64 = pkgsCross.mingwW64.callPackage ./dxvk.nix {
|
|
||||||
inherit (finalAttrs) src version dxvkPatches;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Split out by platform to make maintenance easy in case supported versions on Darwin and other
|
|
||||||
# platforms diverge (due to the need for Darwin-specific patches that would fail to apply).
|
|
||||||
# Should that happen, set `darwin` to the last working `rev` and `hash`.
|
|
||||||
srcs = rec {
|
|
||||||
darwin = {
|
|
||||||
rev = "v${finalAttrs.version}";
|
|
||||||
hash = "sha256-T93ZylxzJGprrP+j6axZwl2d3hJowMCUOKNjIyNzkmE=";
|
|
||||||
version = "1.10.3";
|
|
||||||
};
|
|
||||||
default = {
|
|
||||||
rev = "v${finalAttrs.version}";
|
|
||||||
hash = "sha256-mboVLdPgZMzmqyeF0jAloEz6xqfIDiY/X98e7l2KZnw=";
|
|
||||||
version = "2.0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
name = "dxvk";
|
name = "dxvk";
|
||||||
inherit (srcs."${system}" or srcs.default) version;
|
inherit (dxvk64) version;
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "doitsujin";
|
|
||||||
repo = "dxvk";
|
|
||||||
inherit (srcs."${system}" or srcs.default) rev hash;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Override this to patch DXVK itself (rather than the setup script).
|
|
||||||
dxvkPatches = lib.optionals stdenvNoCC.isDarwin [
|
|
||||||
# Patch DXVK to work with MoltenVK even though it doesn’t 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
|
|
||||||
];
|
|
||||||
|
|
||||||
outputs = [ "out" "bin" "lib" ];
|
outputs = [ "out" "bin" "lib" ];
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
dontConfigure = true;
|
dontConfigure = true;
|
||||||
dontBuild = true;
|
dontBuild = true;
|
||||||
|
|
||||||
|
|
|
@ -5,28 +5,56 @@
|
||||||
, meson
|
, meson
|
||||||
, ninja
|
, ninja
|
||||||
, windows
|
, windows
|
||||||
, src
|
, dxvkVersion
|
||||||
, version
|
|
||||||
, spirv-headers
|
, spirv-headers
|
||||||
, vulkan-headers
|
, vulkan-headers
|
||||||
, dxvkPatches
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
# DXVK 2.0+ no longer vendors certain dependencies. This derivation also needs to build on Darwin,
|
# 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.
|
# which does not currently support DXVK 2.0, so adapt conditionally for this situation.
|
||||||
isDxvk2 = lib.versionAtLeast version "2.0";
|
isDxvk2 = lib.versionAtLeast (srcs.${dxvkVersion}.version) "2.0";
|
||||||
|
|
||||||
|
# DXVK has effectively the same build script regardless of platform.
|
||||||
|
srcs = {
|
||||||
|
"1.10" = rec {
|
||||||
|
version = "1.10.3";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "doitsujin";
|
||||||
|
repo = "dxvk";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-T93ZylxzJGprrP+j6axZwl2d3hJowMCUOKNjIyNzkmE=";
|
||||||
|
};
|
||||||
|
# These patches are required when using DXVK with Wine on Darwin.
|
||||||
|
patches = lib.optionals stdenv.buildPlatform.isDarwin [
|
||||||
|
# Patch DXVK to work with MoltenVK even though it doesn’t 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
|
||||||
|
];
|
||||||
|
};
|
||||||
|
"2.0" = rec {
|
||||||
|
version = "2.0";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "doitsujin";
|
||||||
|
repo = "dxvk";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-mboVLdPgZMzmqyeF0jAloEz6xqfIDiY/X98e7l2KZnw=";
|
||||||
|
};
|
||||||
|
patches = [ ];
|
||||||
|
};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
pname = "dxvk";
|
pname = "dxvk";
|
||||||
inherit src version;
|
inherit (srcs.${dxvkVersion}) version src patches;
|
||||||
|
|
||||||
nativeBuildInputs = [ glslang meson ninja ];
|
nativeBuildInputs = [ glslang meson ninja ];
|
||||||
buildInputs = [ windows.pthreads ]
|
buildInputs = [ windows.pthreads ]
|
||||||
++ lib.optionals isDxvk2 [ spirv-headers vulkan-headers ];
|
++ lib.optionals isDxvk2 [ spirv-headers vulkan-headers ];
|
||||||
|
|
||||||
patches = dxvkPatches;
|
|
||||||
|
|
||||||
preConfigure = lib.optionalString isDxvk2 ''
|
preConfigure = lib.optionalString isDxvk2 ''
|
||||||
ln -s ${lib.getDev spirv-headers}/include include/spirv/include
|
ln -s ${lib.getDev spirv-headers}/include include/spirv/include
|
||||||
ln -s ${lib.getDev vulkan-headers}/include include/vulkan/include
|
ln -s ${lib.getDev vulkan-headers}/include include/vulkan/include
|
||||||
|
|
|
@ -37209,6 +37209,8 @@ with pkgs;
|
||||||
dump = callPackage ../tools/backup/dump { };
|
dump = callPackage ../tools/backup/dump { };
|
||||||
|
|
||||||
dxvk = callPackage ../misc/dxvk { };
|
dxvk = callPackage ../misc/dxvk { };
|
||||||
|
dxvk_1 = callPackage ../misc/dxvk/dxvk.nix { dxvkVersion = "1.10"; };
|
||||||
|
dxvk_2 = callPackage ../misc/dxvk/dxvk.nix { dxvkVersion = "2.0"; };
|
||||||
|
|
||||||
ecdsatool = callPackage ../tools/security/ecdsatool { };
|
ecdsatool = callPackage ../tools/security/ecdsatool { };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue