Skip to content

Commit

Permalink
python312Packages.taichi: init at 1.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
arunoruto committed Dec 23, 2024
1 parent 3611af4 commit dad3306
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 0 deletions.
118 changes: 118 additions & 0 deletions pkgs/development/python-modules/taichi/bin.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
config,
lib,
autoPatchelfHook,
autoAddDriverRunpath,
buildPythonPackage,
fetchPypi,
stdenv,
python,
# Dependencies:
dill,
numpy,
colorama,
glew,
glfw,
vulkan-loader,
libX11,
libGL,
libGLU,
libz,
# Options:
cudaSupport ? config.cudaSupport,
cudaPackages,
}:

let
pname = "taichi";
version = "1.7.2";
format = "wheel";
inherit (python) pythonVersion;

packages =
let
getSrcFromPypi =
{
platform,
dist,
hash,
}:
fetchPypi {
inherit
pname
version
format
platform
dist
hash
;
# See the `disabled` attr comment below.
python = dist;
abi = dist;
};
in
{
"3.12-x86_64-linux" = getSrcFromPypi {
platform = "manylinux_2_27_x86_64";
dist = "cp312";
hash = "sha256-b6qNUFsgeAfcTkLhN91q92sL/e29Ku+lrVmiMfNV8QQ=";
};
# "3.12-x86_64-darwin" = getSrcFromPypi {
# platform = "macosx_11_0_x86_64";
# dist = "cp312";
# hash = "";
# };
# "3.12-aarch64-darwin" = getSrcFromPypi {
# platform = "macosx_11_0_arm64";
# dist = "cp312";
# hash = "";
# };
};

libPath = lib.makeLibraryPath (
[
libGL
vulkan-loader
]
++ lib.optionals cudaSupport [ cudaPackages.cudatoolkit ]
);
in
buildPythonPackage {
inherit pname version format;
src =
packages."${pythonVersion}-${stdenv.hostPlatform.system}"
or (throw "taichi-bin is not supported on ${stdenv.hostPlatform.system}");

nativeBuildInputs = [
autoPatchelfHook
] ++ lib.optionals cudaSupport [ autoAddDriverRunpath ];

preInstallCheck = ''
shopt -s globstar
for file in $out/**/*.so; do
patchelf --add-rpath "${libPath}" "$file"
done
'';

propagatedBuildInputs = [
numpy
colorama
dill
glew
glfw
vulkan-loader
libGL
libGLU
libX11
libz
];

meta = with lib; {
description = "Productive, portable, and performant GPU programming in Python.";
homepage = "https://github.com/taichi-dev/taichi";
license = licenses.asl20;
maintainers = with maintainers; [ arunoruto ];
platforms = platforms.all;
};
}
4 changes: 4 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15335,6 +15335,10 @@ self: super: with self; {

tahoma-api = callPackage ../development/python-modules/tahoma-api { };

taichi = callPackage ../development/python-modules/taichi/bin.nix {
inherit (pkgs.config) cudaSupport;
};

tailer = callPackage ../development/python-modules/tailer { };

tailscale = callPackage ../development/python-modules/tailscale { };
Expand Down

0 comments on commit dad3306

Please sign in to comment.