···6{
7 dxvk32_dir=@dxvk32@/bin
8 dxvk64_dir=@dxvk64@/bin
9-10- mcfgthreads32_dir=@mcfgthreads32@/bin
11- mcfgthreads64_dir=@mcfgthreads64@/bin
12}
01314## Defaults
15···18 [d3d10]="dxvk/d3d10.dll dxvk/d3d10_1.dll dxvk/d3d10core.dll"
19 [d3d11]="dxvk/d3d11.dll"
20 [dxgi]="dxvk/dxgi.dll"
00021 [mcfgthreads]="mcfgthreads/mcfgthread-12.dll"
22)
2324-declare -A targets=([d3d9]=1 [d3d11]=1 [dxgi]=1 [mcfgthreads]=1)
00000000002526## Command-line Parsing
27···46}
4748case "${1:-}" in
000049 uninstall|install)
50 action=$1
51 shift
···61 ;;
62esac
6364-65-do_symlink=false
66-do_makeprefix=false
67-68while [ -n "${1:-}" ]; do
69 case "$1" in
70 --with-dxgi)
···100 usage
101 fi
102 ;;
0000103 -h|--help)
104 usage
105 ;;
···110 esac
111 shift
112done
0113114## Get information on the Wine environment
115···165 exit 1
166fi
1670168## Utility functions
169170install_file() {
···200uninstall_file() {
201 srcfile=$1
202 dstfile=$2
0000000203204 if [ -f "${srcfile}.so" ]; then
205 srcfile="${srcfile}.so"
···239 fi
240}
24100000000000000000000242## Perform the requested command
243244declare -A paths
···260 done
261done
262263-for srcpath in "${!paths[@]}"; do
264- "${action}_file" "$srcpath" "${paths["$srcpath"]}"
0000000000000000000000000265 "${action}_override" "$(basename "$srcpath" .dll)"
266done
···6{
7 dxvk32_dir=@dxvk32@/bin
8 dxvk64_dir=@dxvk64@/bin
0009}
10+1112## Defaults
13···16 [d3d10]="dxvk/d3d10.dll dxvk/d3d10_1.dll dxvk/d3d10core.dll"
17 [d3d11]="dxvk/d3d11.dll"
18 [dxgi]="dxvk/dxgi.dll"
19+)
20+21+declare -A obsolete_dlls=(
22 [mcfgthreads]="mcfgthreads/mcfgthread-12.dll"
23)
2425+declare -A targets=([d3d9]=1 [d3d11]=1 [dxgi]=1)
26+27+28+# Option variables
29+30+do_cleanup=false
31+ignore_obsolete=false
32+33+do_symlink=false
34+do_makeprefix=false
35+3637## Command-line Parsing
38···57}
5859case "${1:-}" in
60+ cleanup)
61+ do_cleanup=true
62+ shift
63+ ;;
64 uninstall|install)
65 action=$1
66 shift
···76 ;;
77esac
78000079while [ -n "${1:-}" ]; do
80 case "$1" in
81 --with-dxgi)
···111 usage
112 fi
113 ;;
114+ --ignore-obsolete)
115+ shift
116+ ignore_obsolete=true
117+ ;;
118 -h|--help)
119 usage
120 ;;
···125 esac
126 shift
127done
128+129130## Get information on the Wine environment
131···181 exit 1
182fi
183184+185## Utility functions
186187install_file() {
···217uninstall_file() {
218 srcfile=$1
219 dstfile=$2
220+ args=$3
221+222+ if [ "${args}" = "-f" ]; then
223+ rm -v "${dstfile}"
224+ [ -e "${dstfile}.old" ] && rm -v "${dstfile}.old"
225+ return 0
226+ fi
227228 if [ -f "${srcfile}.so" ]; then
229 srcfile="${srcfile}.so"
···263 fi
264}
265266+print_cleanup_message() {
267+ declare -a obsolete_paths=($@)
268+ if ! $ignore_obsolete && [ -n "${obsolete_paths[@]}" ]; then
269+ fold -w $COLUMNS -s <<MSG >&2
270+Obsolete DLLs detected at the specified Wine prefix. These DLLs are no longer needed \
271+or managed by the \`setup_dxvk.sh\` script in nixpkgs. You should remove them manually, \
272+use the cleanup command, or suppress this message using the \`--ignore-obsolete\` option.
273+MSG
274+ for obspath in "${obsolete_paths[@]}"; do
275+ if $do_cleanup; then
276+ cleanup_file "$obspath"
277+ else
278+ echo " - ${obspath}"
279+ fi
280+ done
281+ ! $do_cleanup && echo
282+ fi
283+}
284+285+286## Perform the requested command
287288declare -A paths
···304 done
305done
306307+declare -A obsolete_paths
308+309+for target in "${!obsolete_dlls[@]}"; do
310+ for dll in ${obsolete_dlls[$target]}; do
311+ dllname=$(basename "$dll")
312+ basedir=$(dirname "$dll")
313+314+ if [ -e "${win32_sys_path:-}/$dllname" ]; then
315+ obsolete_paths["${basedir}32_dir/$dllname"]="${win32_sys_path:-}/$dllname"
316+ fi
317+ if [ -e "${win64_sys_path:-}/$dllname" ]; then
318+ obsolete_paths["${basedir}64_dir/$dllname"]="${win64_sys_path:-}/$dllname"
319+ fi
320+ done
321+done
322+323+if $do_cleanup; then
324+ declare -n action_paths=obsolete_paths
325+ action=uninstall
326+ args=-f
327+else
328+ declare -n action_paths=paths
329+ print_cleanup_message "${obsolete_paths[@]}"
330+fi
331+332+for srcpath in "${!action_paths[@]}"; do
333+ "${action}_file" "$srcpath" "${action_paths["$srcpath"]}" "${args:-}"
334 "${action}_override" "$(basename "$srcpath" .dll)"
335done
+37-23
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
010}:
1112-stdenv.mkDerivation (finalAttrs: {
13 pname = "dxvk";
14 version = "1.10.3";
15···21 };
2223 # These patches are required when using DXVK with Wine on Darwin.
24- patches = lib.optionals enableMoltenVKCompat [
25- # Patch DXVK to work with MoltenVK even though it doesn’t support some required features.
26- # Some games work poorly (particularly Unreal Engine 4 games), but others work pretty well.
27- ./darwin-dxvk-compat.patch
28- # Use synchronization primitives from the C++ standard library to avoid deadlocks on Darwin.
29- # See: https://www.reddit.com/r/macgaming/comments/t8liua/comment/hzsuce9/
30- ./darwin-thread-primitives.patch
31- ];
000000003233- nativeBuildInputs = [ glslang meson ninja ];
00000034 buildInputs = [ windows.pthreads ];
3536- mesonFlags = [
37- "--buildtype" "release"
38- "--prefix" "${placeholder "out"}"
39- ];
4041 meta = {
42 description = "A Vulkan-based translation layer for Direct3D 9/10/11";
···1+{
2+ lib,
3+ stdenv,
4+ fetchFromGitHub,
5+ fetchpatch,
6+ glslang,
7+ meson,
8+ ninja,
9+ windows,
10+ enableMoltenVKCompat ? false,
11}:
1213+stdenv.mkDerivation (finalAttrs: {
14 pname = "dxvk";
15 version = "1.10.3";
16···22 };
2324 # These patches are required when using DXVK with Wine on Darwin.
25+ patches =
26+ [
27+ # Fixes errors building with GCC 13.
28+ (fetchpatch {
29+ url = "https://github.com/doitsujin/dxvk/commit/1a5afc77b1859e6c7e31b55e11ece899e3b5295a.patch";
30+ hash = "sha256-tTAsQOMAazgH/6laLNTuG2lki257VUR9EBivnD4vCuY=";
31+ })
32+ ]
33+ ++ lib.optionals enableMoltenVKCompat [
34+ # Patch DXVK to work with MoltenVK even though it doesn’t support some required features.
35+ # Some games work poorly (particularly Unreal Engine 4 games), but others work pretty well.
36+ ./darwin-dxvk-compat.patch
37+ # Use synchronization primitives from the C++ standard library to avoid deadlocks on Darwin.
38+ # See: https://www.reddit.com/r/macgaming/comments/t8liua/comment/hzsuce9/
39+ ./darwin-thread-primitives.patch
40+ ];
4142+ strictDeps = true;
43+44+ nativeBuildInputs = [
45+ glslang
46+ meson
47+ ninja
48+ ];
49 buildInputs = [ windows.pthreads ];
5051+ mesonBuildType = "release";
52+53+ __structuredAttrs = true;
05455 meta = {
56 description = "A Vulkan-based translation layer for Direct3D 9/10/11";