Add switch for dxvk-async.

This commit is contained in:
Philipp 2021-07-24 16:46:34 +02:00
parent 21cd505119
commit 780f0f5bb7
No known key found for this signature in database
GPG key ID: 2258EE3B85DE1748
2 changed files with 20 additions and 4 deletions

View file

@ -4,6 +4,8 @@
prefixBaseDir ? "$HOME/.winenix",
binName ? "starcitizen",
launcherArgs ? [ "--use-gl=osmesa" ],
dxvkPatches ? [ ],
dxvkAsync ? false,
winePackage ? pkgs.wineWowPackages.unstable,
wineGlobalEnv ? [ "DXVK_STATE_CACHE=0" ],
winePatches ? [ ./patches/joyaxis.patch ],
@ -21,9 +23,11 @@ assert !(builtins.any (lib.strings.hasSuffix "/") [ installDir launcherCache pre
let
winePkg = winePackage.overrideAttrs (attrs: {
patches = attrs.patches ++ winePatches;
});
});
dxvk = (pkgsCross.mingwW64.callPackage ./dxvk.nix { async = dxvkAsync; }).overrideAttrs
( attrs: { patches = attrs.patches ++ dxvkPatches; });
dxvkAsyncEnv = "DXVK_ASYNC=1" ;
dxvk = (with import ~/repositories/nixpkgs/default.nix {}; pkgsCross.mingwW64.callPackage ./dxvk.nix { });
fonts = pkgs.callPackage ./fonts.nix {};
wine64 = "${winePkg}/bin/wine64";
wineMulti = "${winePkg}/bin/wine";
@ -149,7 +153,9 @@ let
export WINEPREFIX="${prefixBaseDir}/$uuid"
#export all global env vars
${lib.concatMapStrings (x: "export " + x + "\n") wineGlobalEnv }
${lib.concatMapStrings (x: "export " + x + "\n") (wineGlobalEnv
++ lib.lists.optional dxvkAsync dxvkAsyncEnv
)}
#parse input
case "$@" in

View file

@ -1,15 +1,25 @@
{ stdenv, lib, fetchFromGitHub, glslang, buildPackages, writeScriptBin, pkgs, pkgsCross }:
{ stdenv, lib, fetchFromGitHub, fetchpatch, glslang, buildPackages, writeScriptBin, pkgs, pkgsCross,
async ? false
}:
let
fix = writeScriptBin "x86_64-w64-mingw32-windres" ''
#!${stdenv.shell}
exec ${pkgsCross.mingwW64.buildPackages.binutils.bintools}/bin/x86_64-w64-mingw32-windres --preprocessor=x86_64-w64-mingw32-gcc --preprocessor-arg=-E --preprocessor-arg=-xc --preprocessor-arg=-DRC_INVOKED $@
'';
asyncPatch = (fetchpatch {
name = "dxvk-async";
url = "https://raw.githubusercontent.com/Sporif/dxvk-async/8911d6da0f838efc8fbbea805da522be4e1ad6c3/dxvk-async.patch";
sha256 = "0mr43flzim25lfq73pac94ah07yrr86n82fzsx47lxlcmsh9zhrq";
});
in stdenv.mkDerivation rec {
pname = "dxvk";
version = "1.9";
patches = []
++ lib.lists.optional async asyncPatch;
src = fetchFromGitHub {
owner = "doitsujin";
repo = "dxvk";