From 05a0240b24d23c7c0731681918f375315ec22838 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sun, 11 Jan 2026 10:59:13 +0000 Subject: [PATCH 1/2] python3Packages.tinygrad: fix on darwin --- pkgs/development/python-modules/tinygrad/default.nix | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/tinygrad/default.nix b/pkgs/development/python-modules/tinygrad/default.nix index d0e0b2418b1e..395b7f60c403 100644 --- a/pkgs/development/python-modules/tinygrad/default.nix +++ b/pkgs/development/python-modules/tinygrad/default.nix @@ -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 = { @@ -251,9 +252,6 @@ buildPythonPackage rec { # Fatal Python error: Aborted # onnxruntime/capi/_pybind_state.py", line 32 in "aarch64-linux" - - # Tests segfault on darwin - lib.systems.inspect.patterns.isDarwin ]; }; } From 684d9912402442f248b9b09e0380a2b8a7e8136c Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sun, 11 Jan 2026 11:01:22 +0000 Subject: [PATCH 2/2] python3Packages.tinygrad: use finalAttrs pattern --- pkgs/development/python-modules/tinygrad/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/tinygrad/default.nix b/pkgs/development/python-modules/tinygrad/default.nix index 395b7f60c403..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="; }; @@ -245,7 +245,7 @@ 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 = [ @@ -254,4 +254,4 @@ buildPythonPackage rec { "aarch64-linux" ]; }; -} +})