1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 cargo,
8 pkg-config,
9 rustPlatform,
10 rustc,
11
12 # buildInputs
13 openssl,
14 stdenv,
15 darwin,
16 libiconv,
17}:
18
19buildPythonPackage rec {
20 pname = "hf-transfer";
21 version = "0.1.8";
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "huggingface";
26 repo = "hf_transfer";
27 rev = "refs/tags/v${version}";
28 hash = "sha256-Uh8q14OeN0fYsywYyNrH8C3wq/qRjQKEAIufi/a5RXA=";
29 };
30
31 cargoDeps = rustPlatform.fetchCargoTarball {
32 inherit src;
33 name = "${pname}-${version}";
34 hash = "sha256-I4APdz1r2KJ8pTfKAg8g240wYy8gtMlHwmBye4796Tk=";
35 };
36
37 build-system = [
38 cargo
39 pkg-config
40 rustPlatform.cargoSetupHook
41 rustPlatform.maturinBuildHook
42 rustc
43 ];
44
45 buildInputs =
46 [
47 openssl
48 ]
49 ++ lib.optionals stdenv.hostPlatform.isDarwin [
50 darwin.apple_sdk.frameworks.Security
51 darwin.apple_sdk.frameworks.SystemConfiguration
52 libiconv
53 ];
54
55 pythonImportsCheck = [ "hf_transfer" ];
56
57 env = {
58 OPENSSL_NO_VENDOR = true;
59 };
60
61 meta = {
62 description = "High speed download python library";
63 homepage = "https://github.com/huggingface/hf_transfer";
64 changelog = "https://github.com/huggingface/hf_transfer/releases/tag/v${version}";
65 license = lib.licenses.asl20;
66 maintainers = with lib.maintainers; [ GaetanLepage ];
67 };
68}