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 pname version src;
37 sourceRoot = "${pname}-${version}/${cargoRoot}";
38 hash = "sha256-HgHvfMBspPsSYhllnKBg5XZB6zxFIqJj+4//xKG8HwA=";
39 };
40
41 nativeBuildInputs = [
42 setuptools
43 setuptoolsRustBuildHook
44 rustPlatform.cargoSetupHook
45 cargo
46 rustc
47 ];
48
49 # Remove when https://github.com/NixOS/nixpkgs/pull/190093 lands.
50 buildInputs = lib.optional stdenv.hostPlatform.isDarwin libiconv;
51
52 nativeCheckInputs = [ pytestCheckHook ];
53
54 pythonImportsCheck = [ "bcrypt" ];
55
56 passthru.tests = {
57 inherit
58 asyncssh
59 django_4
60 fastapi
61 paramiko
62 twisted
63 ;
64 };
65
66 meta = with lib; {
67 description = "Modern password hashing for your software and your servers";
68 homepage = "https://github.com/pyca/bcrypt/";
69 license = licenses.asl20;
70 maintainers = with maintainers; [ domenkozar ];
71 };
72}