From 7dab91f9e36f670bba3abe6d922b34af5c91b3de Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Sun, 30 Mar 2025 20:18:18 -0400 Subject: [PATCH] python312Packages.torch: don't include .cmake files in $out One of the files includes a reference to apple-sdk. This patch reduces the size of the closure on darwin from ~1.5G to ~400M. Signed-off-by: Ihar Hrachyshka --- pkgs/development/python-modules/torch/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/torch/default.nix b/pkgs/development/python-modules/torch/default.nix index 6079bd70b43e..c0a1b251d898 100644 --- a/pkgs/development/python-modules/torch/default.nix +++ b/pkgs/development/python-modules/torch/default.nix @@ -587,8 +587,15 @@ buildPythonPackage rec { find "$out/${python.sitePackages}/torch/include" "$out/${python.sitePackages}/torch/lib" -type f -exec remove-references-to -t ${stdenv.cc} '{}' + mkdir $dev + + # CppExtension requires that include files are packaged with the main + # python library output; which is why they are copied here. cp -r $out/${python.sitePackages}/torch/include $dev/include - cp -r $out/${python.sitePackages}/torch/share $dev/share + + # Cmake files under /share are different and can be safely moved. This + # avoids unnecessary closure blow-up due to apple sdk references when + # USE_DISTRIBUTED is enabled. + mv $out/${python.sitePackages}/torch/share $dev/share # Fix up library paths for split outputs substituteInPlace \