diff --git a/pkgs/development/python-modules/tinygrad/default.nix b/pkgs/development/python-modules/tinygrad/default.nix index d0e0b2418b1e..0eaa076fc091 100644 --- a/pkgs/development/python-modules/tinygrad/default.nix +++ b/pkgs/development/python-modules/tinygrad/default.nix @@ -54,7 +54,7 @@ rocmSupport ? config.rocmSupport, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "tinygrad"; version = "0.11.0"; pyproject = true; @@ -62,7 +62,7 @@ buildPythonPackage rec { src = fetchFromGitHub { owner = "tinygrad"; repo = "tinygrad"; - tag = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-VG2rhkiwPFN3JYSBbqrwCdqhdGE8GY6oEatMSCydhw8="; }; @@ -84,15 +84,14 @@ buildPythonPackage rec { substituteInPlace tinygrad/runtime/ops_cpu.py \ --replace-fail "getenv(\"CC\", 'clang')" "'${lib.getExe llvmPackages.clang-unwrapped}'" '' - + '' - substituteInPlace tinygrad/runtime/autogen/libc.py \ - --replace-fail "ctypes.util.find_library('c')" "'${stdenv.cc.libc}/lib/libc.so.6'" - '' + '' substituteInPlace tinygrad/runtime/support/llvm.py \ --replace-fail "ctypes.util.find_library('LLVM')" "'${lib.getLib llvmPackages.llvm}/lib/libLLVM.so'" '' + lib.optionalString stdenv.hostPlatform.isLinux '' + substituteInPlace tinygrad/runtime/autogen/libc.py \ + --replace-fail "ctypes.util.find_library('c')" "'${stdenv.cc.libc}/lib/libc.so.6'" + substituteInPlace tinygrad/runtime/autogen/opencl.py \ --replace-fail "ctypes.util.find_library('OpenCL')" "'${ocl-icd}/lib/libOpenCL.so'" '' @@ -124,6 +123,8 @@ buildPythonPackage rec { --replace-fail "/opt/rocm/" "${rocmPackages.rocm-comgr}/" ''; + __propagatedImpureHostDeps = lib.optional stdenv.hostPlatform.isDarwin "/usr/lib/libc.dylib"; + build-system = [ setuptools ]; optional-dependencies = { @@ -244,16 +245,13 @@ buildPythonPackage rec { meta = { description = "Simple and powerful neural network framework"; homepage = "https://github.com/tinygrad/tinygrad"; - changelog = "https://github.com/tinygrad/tinygrad/releases/tag/v${version}"; + changelog = "https://github.com/tinygrad/tinygrad/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ GaetanLepage ]; badPlatforms = [ # Fatal Python error: Aborted # onnxruntime/capi/_pybind_state.py", line 32 in "aarch64-linux" - - # Tests segfault on darwin - lib.systems.inspect.patterns.isDarwin ]; }; -} +})