nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 70 lines 1.4 kB view raw
1{ 2 lib, 3 stdenv, 4 buildDunePackage, 5 fetchFromGitHub, 6 fetchpatch, 7 cmdliner, 8 ctypes, 9 ctypes-foreign, 10 dune-configurator, 11 npy, 12 ocaml-compiler-libs, 13 ppx_custom_printf, 14 ppx_expect, 15 ppx_sexp_conv, 16 sexplib, 17 stdio, 18 torch, 19}: 20 21buildDunePackage rec { 22 pname = "torch"; 23 version = "0.17"; 24 25 minimalOCamlVersion = "4.08"; 26 27 src = fetchFromGitHub { 28 owner = "LaurentMazare"; 29 repo = "ocaml-${pname}"; 30 rev = version; 31 hash = "sha256-z/9NUBjeFWE63Z/e8OyzDiy8hrn6qzjaiBH8G9MPeos="; 32 }; 33 34 patches = [ 35 # Pytorch 2.0 support. Drop when it reaches a release 36 (fetchpatch { 37 url = "https://github.com/LaurentMazare/ocaml-torch/commit/ef7ef30cafecb09e45ec1ed8ce4bedae5947cfa5.patch"; 38 hash = "sha256-smdwKy40iIISp/25L2J4az6KmqFS1soeChBElUyhl5A="; 39 }) 40 ]; 41 42 buildInputs = [ dune-configurator ]; 43 44 propagatedBuildInputs = [ 45 cmdliner 46 ctypes 47 ctypes-foreign 48 npy 49 ocaml-compiler-libs 50 ppx_custom_printf 51 ppx_expect 52 ppx_sexp_conv 53 sexplib 54 stdio 55 torch 56 torch.dev 57 ]; 58 59 preBuild = "export LIBTORCH=${torch.dev}/"; 60 61 doCheck = !stdenv.hostPlatform.isAarch64; 62 63 meta = { 64 inherit (src.meta) homepage; 65 description = "Ocaml bindings to Pytorch"; 66 maintainers = [ lib.maintainers.bcdarwin ]; 67 license = lib.licenses.asl20; 68 broken = true; # Not compatible with libtorch ≥ 2.3.0 69 }; 70}