1{
2 lib,
3 buildPythonPackage,
4 cargo,
5 rustPlatform,
6 rustc,
7 setuptools,
8 setuptools-rust,
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.1.3";
25 format = "pyproject";
26
27 disabled = pythonOlder "3.6";
28
29 src = fetchPypi {
30 inherit pname version;
31 hash = "sha256-LuFd10n1lS/j8EMND/a3QILhWcUDMqFBPVG1aJzwZiM=";
32 };
33
34 cargoRoot = "src/_bcrypt";
35 cargoDeps = rustPlatform.fetchCargoTarball {
36 inherit src;
37 sourceRoot = "${pname}-${version}/${cargoRoot}";
38 name = "${pname}-${version}";
39 hash = "sha256-Uag1pUuis5lpnus2p5UrMLa4HP7VQLhKxR5TEMfpK0s=";
40 };
41
42 nativeBuildInputs = [
43 setuptools
44 setuptools-rust
45 rustPlatform.cargoSetupHook
46 cargo
47 rustc
48 ];
49
50 # Remove when https://github.com/NixOS/nixpkgs/pull/190093 lands.
51 buildInputs = lib.optional stdenv.isDarwin libiconv;
52
53 nativeCheckInputs = [ pytestCheckHook ];
54
55 pythonImportsCheck = [ "bcrypt" ];
56
57 passthru.tests = {
58 inherit
59 asyncssh
60 django_4
61 fastapi
62 paramiko
63 twisted
64 ;
65 };
66
67 meta = with lib; {
68 description = "Modern password hashing for your software and your servers";
69 homepage = "https://github.com/pyca/bcrypt/";
70 license = licenses.asl20;
71 maintainers = with maintainers; [ domenkozar ];
72 };
73}