1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 libiconv,
7 numpy,
8 pytestCheckHook,
9 rustPlatform,
10 nix-update-script,
11}:
12
13buildPythonPackage rec {
14 pname = "blake3";
15 version = "1.0.7";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "oconnor663";
20 repo = "blake3-py";
21 tag = version;
22 hash = "sha256-km4vN/xKvjNd/bdHEIsUR9+Hmi0K5ju+wlQ2kuuDzzI=";
23 };
24
25 postPatch = ''
26 ln -s '${./Cargo.lock}' Cargo.lock
27 '';
28
29 cargoDeps = rustPlatform.importCargoLock {
30 lockFile = ./Cargo.lock;
31 };
32
33 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
34 libiconv
35 ];
36
37 nativeBuildInputs = with rustPlatform; [
38 cargoSetupHook
39 maturinBuildHook
40 ];
41
42 nativeCheckInputs = [
43 pytestCheckHook
44 numpy
45 ];
46
47 pythonImportsCheck = [ "blake3" ];
48
49 passthru.updateScript = nix-update-script {
50 extraArgs = [
51 "--generate-lockfile"
52 ];
53 };
54
55 meta = {
56 description = "Python bindings for the BLAKE3 cryptographic hash function";
57 homepage = "https://github.com/oconnor663/blake3-py";
58 changelog = "https://github.com/oconnor663/blake3-py/releases/tag/${version}";
59 license = with lib.licenses; [
60 cc0
61 asl20
62 ];
63 maintainers = with lib.maintainers; [ Luflosi ];
64 };
65}