Unverified Commit 0b1caaa2 authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

python3Packages.mlx: inject absolute path to clang++ instead of $CXX, cleanup (#479031)

parents a2f17031 39c51447
Loading
Loading
Loading
Loading
+115 −112
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  replaceVars,
@@ -22,6 +23,9 @@
  pytestCheckHook,
  python,
  runCommand,

  # passthru
  mlx,
}:

let
@@ -33,7 +37,8 @@ let
    hash = "sha256-15FvyPOFqTOr5vdWQoPnZz+mYH919++EtghjozDlnSA=";
  };

  mlx = buildPythonPackage rec {
in
buildPythonPackage (finalAttrs: {
  pname = "mlx";
  version = "0.30.1";
  pyproject = true;
@@ -41,7 +46,7 @@ let
  src = fetchFromGitHub {
    owner = "ml-explore";
    repo = "mlx";
      tag = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-Vt0RH+70VBwUjXSfPTsNdRS3g0ookJHhzf2kvgEtgH8=";
  };

@@ -56,7 +61,7 @@ let
      --replace-fail "nanobind==2.10.2" "nanobind"

    substituteInPlace mlx/backend/cpu/jit_compiler.cpp \
        --replace-fail "g++" "$CXX"
      --replace-fail "g++" "${lib.getExe' stdenv.cc "c++"}"
  '';

  dontUseCmakeConfigure = true;
@@ -123,11 +128,11 @@ let
          nativeBuildInputs = [ python ];
        }
        ''
            cp ${src}/examples/python/logistic_regression.py .
          cp ${finalAttrs.src}/examples/python/logistic_regression.py .
          ${python.interpreter} logistic_regression.py
          rm logistic_regression.py

            cp ${src}/examples/python/linear_regression.py .
          cp ${finalAttrs.src}/examples/python/linear_regression.py .
          ${python.interpreter} linear_regression.py
          rm linear_regression.py

@@ -138,7 +143,7 @@ let
  meta = {
    homepage = "https://github.com/ml-explore/mlx";
    description = "Array framework for Apple silicon";
      changelog = "https://github.com/ml-explore/mlx/releases/tag/${src.tag}";
    changelog = "https://github.com/ml-explore/mlx/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.mit;
    platforms = [ "aarch64-darwin" ];
    maintainers = with lib.maintainers; [
@@ -148,6 +153,4 @@ let
      viraptor
    ];
  };
  };
in
mlx
})