moltenvk: use functional form of mkDerivation

This allows MoltenVK to be overriden with pinned dependencies.
This commit is contained in:
Randy Eckenrode 2022-06-01 16:27:05 -04:00
parent 54d3d61b0c
commit 22d787323b
No known key found for this signature in database
GPG key ID: 64C1CD4EC2A600D9

View file

@ -27,7 +27,7 @@
let
libcxx.dev = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr";
in
stdenvNoCC.mkDerivation rec {
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "MoltenVK";
version = "1.1.9";
@ -51,7 +51,7 @@ stdenvNoCC.mkDerivation rec {
hash = "sha256-YLn/Mxuk6mXPGtBBgfwky5Nl1TCAW6i2g+AZLzqVz+A=";
};
})).override {
inherit (passthru) spirv-headers spirv-tools;
inherit (finalAttrs.passthru) spirv-headers spirv-tools;
};
spirv-cross = spirv-cross.overrideAttrs (old: {
cmakeFlags = (old.cmakeFlags or [ ]) ++ [
@ -80,7 +80,7 @@ stdenvNoCC.mkDerivation rec {
hash = "sha256-2Mr3HbhRslLpRfwHascl7e/UoPijhrij9Bjg3aCiqBM=";
};
})).override {
inherit (passthru) spirv-headers;
inherit (finalAttrs.passthru) spirv-headers;
};
vulkan-headers = vulkan-headers.overrideAttrs (old: {
src = fetchFromGitHub {
@ -95,7 +95,7 @@ stdenvNoCC.mkDerivation rec {
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "MoltenVK";
rev = "v${version}";
rev = "v${finalAttrs.version}";
hash = "sha256-5ie1IGzZqaYbciFnrBJ1/9V0LEuz7JsEOFXXkG3hJzg=";
};
@ -113,24 +113,24 @@ stdenvNoCC.mkDerivation rec {
substituteInPlace MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj/project.pbxproj \
--replace @@sourceRoot@@ $(pwd) \
--replace @@libcxx@@ "${libcxx.dev}" \
--replace @@glslang@@ "${passthru.glslang}" \
--replace @@spirv-cross@@ "${passthru.spirv-cross}" \
--replace @@spirv-tools@@ "${passthru.glslang.spirv-tools}" \
--replace @@spirv-headers@@ "${passthru.glslang.spirv-headers}"
--replace @@glslang@@ "${finalAttrs.passthru.glslang}" \
--replace @@spirv-cross@@ "${finalAttrs.passthru.spirv-cross}" \
--replace @@spirv-tools@@ "${finalAttrs.passthru.glslang.spirv-tools}" \
--replace @@spirv-headers@@ "${finalAttrs.passthru.glslang.spirv-headers}"
substituteInPlace MoltenVK/MoltenVK.xcodeproj/project.pbxproj \
--replace @@sourceRoot@@ $(pwd) \
--replace @@libcxx@@ "${libcxx.dev}" \
--replace @@cereal@@ "${cereal}" \
--replace @@spirv-cross@@ "${passthru.spirv-cross}" \
--replace @@vulkan-headers@@ "${passthru.vulkan-headers}"
--replace @@spirv-cross@@ "${finalAttrs.passthru.spirv-cross}" \
--replace @@vulkan-headers@@ "${finalAttrs.passthru.vulkan-headers}"
substituteInPlace Scripts/create_dylib.sh \
--replace @@sourceRoot@@ $(pwd) \
--replace @@glslang@@ "${passthru.glslang}" \
--replace @@spirv-tools@@ "${passthru.glslang.spirv-tools}" \
--replace @@spirv-cross@@ "${passthru.spirv-cross}"
--replace @@glslang@@ "${finalAttrs.passthru.glslang}" \
--replace @@spirv-tools@@ "${finalAttrs.passthru.glslang.spirv-tools}" \
--replace @@spirv-cross@@ "${finalAttrs.passthru.spirv-cross}"
substituteInPlace Scripts/gen_moltenvk_rev_hdr.sh \
--replace @@sourceRoot@@ $(pwd) \
--replace '$(git rev-parse HEAD)' ${src.rev}
--replace '$(git rev-parse HEAD)' ${finalAttrs.src.rev}
'';
dontConfigure = true;
@ -193,4 +193,4 @@ stdenvNoCC.mkDerivation rec {
license = lib.licenses.asl20;
platforms = lib.platforms.darwin;
};
}
})