1{
2 lib,
3 buildPythonPackage,
4 runCommand,
5 fetchFromGitHub,
6 rustPlatform,
7 maturin,
8 protobuf_30,
9}:
10buildPythonPackage rec {
11 pname = "pyluwen";
12 version = "0.7.11";
13 pyproject = true;
14
15 src = fetchFromGitHub {
16 owner = "tenstorrent";
17 repo = "luwen";
18 tag = "v${version}";
19 hash = "sha256-eQpKEeuy0mVrmu8ssAOWBcXi7zutStu+RbZOEF/IJ98=";
20 };
21
22 cargoDeps = rustPlatform.fetchCargoVendor {
23 inherit src;
24 hash = "sha256-INzF8ORkrmPQMJbGSNm5QkfMOgE+HJ3taU1EZ9i+HJg=";
25 };
26
27 sourceRoot = "${src.name}/crates/${pname}";
28
29 prePatch = ''
30 chmod -R u+w ../../
31 cd ../../
32 '';
33
34 postPatch = ''
35 cd ../$sourceRoot
36 cp --no-preserve=ownership,mode ../../Cargo.lock .
37 '';
38
39 nativeBuildInputs = with rustPlatform; [
40 cargoSetupHook
41 maturinBuildHook
42 protobuf_30
43 ];
44
45 build-system = [ maturin ];
46
47 meta = {
48 description = "Tenstorrent system interface library";
49 homepage = "https://github.com/tenstorrent/luwen";
50 maintainers = with lib.maintainers; [ RossComputerGuy ];
51 license = with lib.licenses; [ asl20 ];
52 };
53}