Merge pull request #144814 from kevinmehall/pytorch

PyTorch: Reduce closure size by ~500MB

authored by Rick van Schijndel and committed by GitHub 59ae32d2 7a10d6f2

+6 -2
+6 -2
pkgs/development/python-modules/pytorch/default.nix
··· 6 6 cudaArchList ? null, 7 7 8 8 # Native build inputs 9 - cmake, util-linux, linkFarm, symlinkJoin, which, pybind11, 9 + cmake, util-linux, linkFarm, symlinkJoin, which, pybind11, removeReferencesTo, 10 10 11 11 # Build inputs 12 12 numactl, ··· 220 220 which 221 221 ninja 222 222 pybind11 223 + removeReferencesTo 223 224 ] ++ lib.optionals cudaSupport [ cudatoolkit_joined ]; 224 225 225 226 buildInputs = [ blas blas.provider ] ··· 259 260 ]) 260 261 ]; 261 262 postInstall = '' 263 + find "$out/${python.sitePackages}/torch/include" "$out/${python.sitePackages}/torch/lib" -type f -exec remove-references-to -t ${stdenv.cc} '{}' + 264 + 262 265 mkdir $dev 263 266 cp -r $out/${python.sitePackages}/torch/include $dev/include 264 267 cp -r $out/${python.sitePackages}/torch/share $dev/share ··· 273 276 --replace \''${_IMPORT_PREFIX}/lib "$lib/lib" 274 277 275 278 mkdir $lib 276 - cp -r $out/${python.sitePackages}/torch/lib $lib/lib 279 + mv $out/${python.sitePackages}/torch/lib $lib/lib 280 + ln -s $lib/lib $out/${python.sitePackages}/torch/lib 277 281 ''; 278 282 279 283 postFixup = lib.optionalString stdenv.isDarwin ''