···6, pkgsCross
7}:
89-let
10- inherit (hostPlatform.uname) system;
11-12- # DXVK needs to be a separate derivation because it’s actually a set of DLLs for Windows that
13- # needs to be built with a cross-compiler.
14- dxvk32 = pkgsCross.mingw32.callPackage ./dxvk.nix { inherit (self) src version dxvkPatches; };
15- dxvk64 = pkgsCross.mingwW64.callPackage ./dxvk.nix { inherit (self) src version dxvkPatches; };
16-17- # Split out by platform to make maintenance easy in case supported versions on Darwin and other
18- # platforms diverge (due to the need for Darwin-specific patches that would fail to apply).
19- # Should that happen, set `darwin` to the last working `rev` and `hash`.
20- srcs = rec {
21- darwin = { inherit (default) rev hash version; };
22- default = {
23- rev = "v${self.version}";
24- hash = "sha256-+6PkrkamSvhCaGj2tq+RXri/yQ7vs0cAqgdRAFtU8UA=";
25- version = "1.10.1";
26 };
27- };
002829- # Use the self pattern to support overriding `src` and `version` via `overrideAttrs`. A recursive
30- # attrset wouldn’t work.
31- self = stdenvNoCC.mkDerivation {
000000000032 name = "dxvk";
33 inherit (srcs."${system}" or srcs.default) version;
34···70 done
71 '';
7273- # DXVK with MoltenVK requires a patched MoltenVK in addition to its own patches. Provide a
74- # convenience function to handle the necessary patching.
75- #
76- # Usage:
77- # let
78- # patchedMoltenVK = dxvk.patchMoltenVK darwin.moltenvk;
79- # in
80- # wine64Packages.full.override { moltenvk = patchedMoltenVK; vkd3dSupport = false; }
81- passthru.patchMoltenVK = moltenvk:
82- moltenvk.overrideAttrs (old: {
83- patches = old.patches or [ ] ++ [
84- # Apply MoltenVK’s DXVK compatability patch. This is needed to fake support for certain
85- # extensions. There is no package for a patched MoltenVK to avoid any confusion by users
86- # whether they should use it. Except with DXVK, the answer is always no.
87- old.passthru.dxvkPatch
88- ];
89- });
90-91 meta = {
92 description = "A Vulkan-based translation layer for Direct3D 9/10/11";
93 homepage = "https://github.com/doitsujin/dxvk";
94 changelog = "https://github.com/doitsujin/dxvk/releases";
95 maintainers = [ lib.maintainers.reckenrode ];
96 license = lib.licenses.zlib;
97- platforms = lib.platforms.unix;
98 };
99- };
100-in
101-self
···6, pkgsCross
7}:
89+stdenvNoCC.mkDerivation (finalAttrs:
10+ let
11+ inherit (hostPlatform.uname) system;
12+ # DXVK needs to be a separate derivation because it’s actually a set of DLLs for Windows that
13+ # needs to be built with a cross-compiler.
14+ dxvk32 = pkgsCross.mingw32.callPackage ./dxvk.nix {
15+ inherit (finalAttrs) src version dxvkPatches;
000000000016 };
17+ dxvk64 = pkgsCross.mingwW64.callPackage ./dxvk.nix {
18+ inherit (finalAttrs) src version dxvkPatches;
19+ };
2021+ # Split out by platform to make maintenance easy in case supported versions on Darwin and other
22+ # platforms diverge (due to the need for Darwin-specific patches that would fail to apply).
23+ # Should that happen, set `darwin` to the last working `rev` and `hash`.
24+ srcs = rec {
25+ darwin = { inherit (default) rev hash version; };
26+ default = {
27+ rev = "v${finalAttrs.version}";
28+ hash = "sha256-+6PkrkamSvhCaGj2tq+RXri/yQ7vs0cAqgdRAFtU8UA=";
29+ version = "1.10.1";
30+ };
31+ };
32+ in
33+ {
34 name = "dxvk";
35 inherit (srcs."${system}" or srcs.default) version;
36···72 done
73 '';
7400000000000000000075 meta = {
76 description = "A Vulkan-based translation layer for Direct3D 9/10/11";
77 homepage = "https://github.com/doitsujin/dxvk";
78 changelog = "https://github.com/doitsujin/dxvk/releases";
79 maintainers = [ lib.maintainers.reckenrode ];
80 license = lib.licenses.zlib;
81+ platforms = [ "x86_64-darwin" "i686-linux" "x86_64-linux" ];
82 };
83+ })
00
+15-19
pkgs/os-specific/darwin/moltenvk/default.nix
···27let
28 libcxx.dev = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr";
29in
30-stdenvNoCC.mkDerivation rec {
31 pname = "MoltenVK";
32 version = "1.1.9";
33···43 # MoltenVK requires specific versions of its dependencies.
44 # Pin them here except for cereal, which is four years old and has several CVEs.
45 passthru = {
46- # The patch required to support DXVK may different from version to version. This should never
47- # be used except with DXVK, so there’s no package for it. To emphasize that this patch should
48- # never be used except with DXVK, `dxvk` provides a function for applying this patch.
49- dxvkPatch = ./dxvk-moltenvk-compat.patch;
50 glslang = (glslang.overrideAttrs (old: {
51 src = fetchFromGitHub {
52 owner = "KhronosGroup";
···55 hash = "sha256-YLn/Mxuk6mXPGtBBgfwky5Nl1TCAW6i2g+AZLzqVz+A=";
56 };
57 })).override {
58- inherit (passthru) spirv-headers spirv-tools;
59 };
60 spirv-cross = spirv-cross.overrideAttrs (old: {
61 cmakeFlags = (old.cmakeFlags or [ ]) ++ [
···84 hash = "sha256-2Mr3HbhRslLpRfwHascl7e/UoPijhrij9Bjg3aCiqBM=";
85 };
86 })).override {
87- inherit (passthru) spirv-headers;
88 };
89 vulkan-headers = vulkan-headers.overrideAttrs (old: {
90 src = fetchFromGitHub {
···99 src = fetchFromGitHub {
100 owner = "KhronosGroup";
101 repo = "MoltenVK";
102- rev = "v${version}";
103 hash = "sha256-5ie1IGzZqaYbciFnrBJ1/9V0LEuz7JsEOFXXkG3hJzg=";
104 };
105···117 substituteInPlace MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj/project.pbxproj \
118 --replace @@sourceRoot@@ $(pwd) \
119 --replace @@libcxx@@ "${libcxx.dev}" \
120- --replace @@glslang@@ "${passthru.glslang}" \
121- --replace @@spirv-cross@@ "${passthru.spirv-cross}" \
122- --replace @@spirv-tools@@ "${passthru.glslang.spirv-tools}" \
123- --replace @@spirv-headers@@ "${passthru.glslang.spirv-headers}"
124 substituteInPlace MoltenVK/MoltenVK.xcodeproj/project.pbxproj \
125 --replace @@sourceRoot@@ $(pwd) \
126 --replace @@libcxx@@ "${libcxx.dev}" \
127 --replace @@cereal@@ "${cereal}" \
128- --replace @@spirv-cross@@ "${passthru.spirv-cross}" \
129- --replace @@vulkan-headers@@ "${passthru.vulkan-headers}"
130 substituteInPlace Scripts/create_dylib.sh \
131 --replace @@sourceRoot@@ $(pwd) \
132- --replace @@glslang@@ "${passthru.glslang}" \
133- --replace @@spirv-tools@@ "${passthru.glslang.spirv-tools}" \
134- --replace @@spirv-cross@@ "${passthru.spirv-cross}"
135 substituteInPlace Scripts/gen_moltenvk_rev_hdr.sh \
136 --replace @@sourceRoot@@ $(pwd) \
137- --replace '$(git rev-parse HEAD)' ${src.rev}
138 '';
139140 dontConfigure = true;
···197 license = lib.licenses.asl20;
198 platforms = lib.platforms.darwin;
199 };
200-}