From df4ccb0394b7db03bec7780872069c919e5895a3 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 27 Jul 2021 20:56:30 +0200 Subject: [PATCH] Add vulkanDriver build option. --- README.md | 1 + default.nix | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c161890..6f85d8b 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ into the `Program Files` folder of the prefixs. * `prefixBaseDir`: Where all the prefixes are installed under. * `binName`: Name of the generated executable. * `launcherArgs`: Arguments the RSI Launcher is called with. +* `vulkanDrivers`: Force list of vulkan drivers. Supported Elements: `radeon`, `intel` and `amdvlk` * `winePackage`: Package of wine to use. * `wineSrc`: Points to the source to build wine from. * `wineGlobalEnv`: Global variables that are exported at script startup. diff --git a/default.nix b/default.nix index 00157e2..6de4db4 100644 --- a/default.nix +++ b/default.nix @@ -4,6 +4,7 @@ prefixBaseDir ? "$HOME/.winenix", binName ? "starcitizen", launcherArgs ? [ "--use-gl=osmesa" ], + vulkanDrivers ? [ ], dxvkPatches ? [ ], dxvkAsync ? false, winePackage ? pkgs.wineWowPackages.unstable, @@ -34,7 +35,12 @@ let ( attrs: { patches = attrs.patches ++ dxvkPatches; }); dxvkAsyncEnv = "DXVK_ASYNC=1" ; gamescope = "${pkgs.callPackage ./gamescope.nix {}}/bin/gamescope"; - + vulkanDriverPaths = { + radeon = "${pkgs.mesa_drivers.drivers}/share/vulkan/icd.d/radeon_icd.x86_64.json"; + intel = "${pkgs.mesa_drivers.drivers}/share/vulkan/icd.d/intel_icd.x86_64.json"; + amdvlk = "${pkgs.amdvlk}/share/vulkan/icd.d/amd_icd64.json"; + }; + vkIcd = lib.strings.concatStringsSep ":" (lib.attrsets.attrVals vulkanDrivers vulkanDriverPaths); fonts = pkgs.callPackage ./fonts.nix {}; wine64 = "${winePkg}/bin/wine64"; wineMulti = "${winePkg}/bin/wine"; @@ -166,6 +172,10 @@ let export WINEPREFIX="${prefixBaseDir}/$uuid" export WINEARCH=win64 + #optionally export vulkan drivers: + #The following line might be empty in the resulting script. + ${lib.optionalString (vulkanDrivers != []) "export VK_ICD_FILENAMES=${vkIcd}"} + #export all global env vars ${lib.concatMapStrings (x: "export " + x + "\n") (wineGlobalEnv ++ lib.lists.optional dxvkAsync dxvkAsyncEnv