1{
2 lib,
3 buildPythonPackage,
4 cargo,
5 rustPlatform,
6 rustc,
7 setuptools,
8 setuptoolsRustBuildHook,
9 fetchPypi,
10 pythonOlder,
11 pytestCheckHook,
12 libiconv,
13 stdenv,
14 # for passthru.tests
15 asyncssh,
16 django_4,
17 fastapi,
18 paramiko,
19 twisted,
20}:
21
22buildPythonPackage rec {
23 pname = "bcrypt";
24 version = "4.3.0";
25 format = "pyproject";
26
27 disabled = pythonOlder "3.6";
28
29 src = fetchPypi {
30 inherit pname version;
31 hash = "sha256-Oj/SIEF4ttKtzwnLT2Qm/+9UdiV3p8m1TBWQCMsojBg=";
32 };
33
34 cargoRoot = "src/_bcrypt";
35 cargoDeps = rustPlatform.fetchCargoVendor {
36 inherit
37 pname
38 version
39 src
40 cargoRoot
41 ;
42 hash = "sha256-HgHvfMBspPsSYhllnKBg5XZB6zxFIqJj+4//xKG8HwA=";
43 };
44
45 nativeBuildInputs = [
46 setuptools
47 setuptoolsRustBuildHook
48 rustPlatform.cargoSetupHook
49 cargo
50 rustc
51 ];
52
53 # Remove when https://github.com/NixOS/nixpkgs/pull/190093 lands.
54 buildInputs = lib.optional stdenv.hostPlatform.isDarwin libiconv;
55
56 nativeCheckInputs = [ pytestCheckHook ];
57
58 pythonImportsCheck = [ "bcrypt" ];
59
60 passthru.tests = {
61 inherit
62 asyncssh
63 django_4
64 fastapi
65 paramiko
66 twisted
67 ;
68 };
69
70 meta = with lib; {
71 description = "Modern password hashing for your software and your servers";
72 homepage = "https://github.com/pyca/bcrypt/";
73 license = licenses.asl20;
74 maintainers = with maintainers; [ ];
75 };
76}