···66, pkgsCross
77}:
8899-let
1010- inherit (hostPlatform.uname) system;
1111-1212- # DXVK needs to be a separate derivation because it’s actually a set of DLLs for Windows that
1313- # needs to be built with a cross-compiler.
1414- dxvk32 = pkgsCross.mingw32.callPackage ./dxvk.nix { inherit (self) src version dxvkPatches; };
1515- dxvk64 = pkgsCross.mingwW64.callPackage ./dxvk.nix { inherit (self) src version dxvkPatches; };
1616-1717- # Split out by platform to make maintenance easy in case supported versions on Darwin and other
1818- # platforms diverge (due to the need for Darwin-specific patches that would fail to apply).
1919- # Should that happen, set `darwin` to the last working `rev` and `hash`.
2020- srcs = rec {
2121- darwin = { inherit (default) rev hash version; };
2222- default = {
2323- rev = "v${self.version}";
2424- hash = "sha256-+6PkrkamSvhCaGj2tq+RXri/yQ7vs0cAqgdRAFtU8UA=";
2525- version = "1.10.1";
99+stdenvNoCC.mkDerivation (finalAttrs:
1010+ let
1111+ inherit (hostPlatform.uname) system;
1212+ # DXVK needs to be a separate derivation because it’s actually a set of DLLs for Windows that
1313+ # needs to be built with a cross-compiler.
1414+ dxvk32 = pkgsCross.mingw32.callPackage ./dxvk.nix {
1515+ inherit (finalAttrs) src version dxvkPatches;
2616 };
2727- };
1717+ dxvk64 = pkgsCross.mingwW64.callPackage ./dxvk.nix {
1818+ inherit (finalAttrs) src version dxvkPatches;
1919+ };
28202929- # Use the self pattern to support overriding `src` and `version` via `overrideAttrs`. A recursive
3030- # attrset wouldn’t work.
3131- self = stdenvNoCC.mkDerivation {
2121+ # Split out by platform to make maintenance easy in case supported versions on Darwin and other
2222+ # platforms diverge (due to the need for Darwin-specific patches that would fail to apply).
2323+ # Should that happen, set `darwin` to the last working `rev` and `hash`.
2424+ srcs = rec {
2525+ darwin = { inherit (default) rev hash version; };
2626+ default = {
2727+ rev = "v${finalAttrs.version}";
2828+ hash = "sha256-+6PkrkamSvhCaGj2tq+RXri/yQ7vs0cAqgdRAFtU8UA=";
2929+ version = "1.10.1";
3030+ };
3131+ };
3232+ in
3333+ {
3234 name = "dxvk";
3335 inherit (srcs."${system}" or srcs.default) version;
3436···7072 done
7173 '';
72747373- # DXVK with MoltenVK requires a patched MoltenVK in addition to its own patches. Provide a
7474- # convenience function to handle the necessary patching.
7575- #
7676- # Usage:
7777- # let
7878- # patchedMoltenVK = dxvk.patchMoltenVK darwin.moltenvk;
7979- # in
8080- # wine64Packages.full.override { moltenvk = patchedMoltenVK; vkd3dSupport = false; }
8181- passthru.patchMoltenVK = moltenvk:
8282- moltenvk.overrideAttrs (old: {
8383- patches = old.patches or [ ] ++ [
8484- # Apply MoltenVK’s DXVK compatability patch. This is needed to fake support for certain
8585- # extensions. There is no package for a patched MoltenVK to avoid any confusion by users
8686- # whether they should use it. Except with DXVK, the answer is always no.
8787- old.passthru.dxvkPatch
8888- ];
8989- });
9090-9175 meta = {
9276 description = "A Vulkan-based translation layer for Direct3D 9/10/11";
9377 homepage = "https://github.com/doitsujin/dxvk";
9478 changelog = "https://github.com/doitsujin/dxvk/releases";
9579 maintainers = [ lib.maintainers.reckenrode ];
9680 license = lib.licenses.zlib;
9797- platforms = lib.platforms.unix;
8181+ platforms = [ "x86_64-darwin" "i686-linux" "x86_64-linux" ];
9882 };
9999- };
100100-in
101101-self
8383+ })
+15-19
pkgs/os-specific/darwin/moltenvk/default.nix
···2727let
2828 libcxx.dev = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr";
2929in
3030-stdenvNoCC.mkDerivation rec {
3030+stdenvNoCC.mkDerivation (finalAttrs: {
3131 pname = "MoltenVK";
3232 version = "1.1.9";
3333···4343 # MoltenVK requires specific versions of its dependencies.
4444 # Pin them here except for cereal, which is four years old and has several CVEs.
4545 passthru = {
4646- # The patch required to support DXVK may different from version to version. This should never
4747- # be used except with DXVK, so there’s no package for it. To emphasize that this patch should
4848- # never be used except with DXVK, `dxvk` provides a function for applying this patch.
4949- dxvkPatch = ./dxvk-moltenvk-compat.patch;
5046 glslang = (glslang.overrideAttrs (old: {
5147 src = fetchFromGitHub {
5248 owner = "KhronosGroup";
···5551 hash = "sha256-YLn/Mxuk6mXPGtBBgfwky5Nl1TCAW6i2g+AZLzqVz+A=";
5652 };
5753 })).override {
5858- inherit (passthru) spirv-headers spirv-tools;
5454+ inherit (finalAttrs.passthru) spirv-headers spirv-tools;
5955 };
6056 spirv-cross = spirv-cross.overrideAttrs (old: {
6157 cmakeFlags = (old.cmakeFlags or [ ]) ++ [
···8480 hash = "sha256-2Mr3HbhRslLpRfwHascl7e/UoPijhrij9Bjg3aCiqBM=";
8581 };
8682 })).override {
8787- inherit (passthru) spirv-headers;
8383+ inherit (finalAttrs.passthru) spirv-headers;
8884 };
8985 vulkan-headers = vulkan-headers.overrideAttrs (old: {
9086 src = fetchFromGitHub {
···9995 src = fetchFromGitHub {
10096 owner = "KhronosGroup";
10197 repo = "MoltenVK";
102102- rev = "v${version}";
9898+ rev = "v${finalAttrs.version}";
10399 hash = "sha256-5ie1IGzZqaYbciFnrBJ1/9V0LEuz7JsEOFXXkG3hJzg=";
104100 };
105101···117113 substituteInPlace MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj/project.pbxproj \
118114 --replace @@sourceRoot@@ $(pwd) \
119115 --replace @@libcxx@@ "${libcxx.dev}" \
120120- --replace @@glslang@@ "${passthru.glslang}" \
121121- --replace @@spirv-cross@@ "${passthru.spirv-cross}" \
122122- --replace @@spirv-tools@@ "${passthru.glslang.spirv-tools}" \
123123- --replace @@spirv-headers@@ "${passthru.glslang.spirv-headers}"
116116+ --replace @@glslang@@ "${finalAttrs.passthru.glslang}" \
117117+ --replace @@spirv-cross@@ "${finalAttrs.passthru.spirv-cross}" \
118118+ --replace @@spirv-tools@@ "${finalAttrs.passthru.glslang.spirv-tools}" \
119119+ --replace @@spirv-headers@@ "${finalAttrs.passthru.glslang.spirv-headers}"
124120 substituteInPlace MoltenVK/MoltenVK.xcodeproj/project.pbxproj \
125121 --replace @@sourceRoot@@ $(pwd) \
126122 --replace @@libcxx@@ "${libcxx.dev}" \
127123 --replace @@cereal@@ "${cereal}" \
128128- --replace @@spirv-cross@@ "${passthru.spirv-cross}" \
129129- --replace @@vulkan-headers@@ "${passthru.vulkan-headers}"
124124+ --replace @@spirv-cross@@ "${finalAttrs.passthru.spirv-cross}" \
125125+ --replace @@vulkan-headers@@ "${finalAttrs.passthru.vulkan-headers}"
130126 substituteInPlace Scripts/create_dylib.sh \
131127 --replace @@sourceRoot@@ $(pwd) \
132132- --replace @@glslang@@ "${passthru.glslang}" \
133133- --replace @@spirv-tools@@ "${passthru.glslang.spirv-tools}" \
134134- --replace @@spirv-cross@@ "${passthru.spirv-cross}"
128128+ --replace @@glslang@@ "${finalAttrs.passthru.glslang}" \
129129+ --replace @@spirv-tools@@ "${finalAttrs.passthru.glslang.spirv-tools}" \
130130+ --replace @@spirv-cross@@ "${finalAttrs.passthru.spirv-cross}"
135131 substituteInPlace Scripts/gen_moltenvk_rev_hdr.sh \
136132 --replace @@sourceRoot@@ $(pwd) \
137137- --replace '$(git rev-parse HEAD)' ${src.rev}
133133+ --replace '$(git rev-parse HEAD)' ${finalAttrs.src.rev}
138134 '';
139135140136 dontConfigure = true;
···197193 license = lib.licenses.asl20;
198194 platforms = lib.platforms.darwin;
199195 };
200200-}
196196+})