2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
callPackage,
|
2024-09-19 14:19:46 +00:00
|
|
|
setuptools,
|
|
|
|
bcrypt,
|
2024-06-05 15:53:02 +00:00
|
|
|
certifi,
|
|
|
|
cffi,
|
|
|
|
cryptography-vectors ? (callPackage ./vectors.nix { }),
|
|
|
|
fetchPypi,
|
|
|
|
isPyPy,
|
|
|
|
libiconv,
|
|
|
|
libxcrypt,
|
|
|
|
openssl,
|
|
|
|
pkg-config,
|
|
|
|
pretend,
|
|
|
|
pytest-xdist,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
rustPlatform,
|
|
|
|
Security,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cryptography";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "43.0.0"; # Also update the hash in vectors.nix
|
2024-01-02 11:29:13 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-uIB1raLVGqnxgoNTLJ9g5yFwBBu6iNfzfknLsQJ1KZ4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
sourceRoot = "${pname}-${version}/${cargoRoot}";
|
|
|
|
name = "${pname}-${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-TEQy8PrIaZshiBFTqR/OJp3e/bVM1USjcmpDYcjPJPM=";
|
2021-03-09 03:18:52 +00:00
|
|
|
};
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
2024-02-29 20:09:43 +00:00
|
|
|
--replace-fail "--benchmark-disable" ""
|
2023-05-24 13:37:59 +00:00
|
|
|
'';
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
cargoRoot = "src/rust";
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
build-system = [
|
2021-03-09 03:18:52 +00:00
|
|
|
rustPlatform.cargoSetupHook
|
2024-09-19 14:19:46 +00:00
|
|
|
rustPlatform.maturinBuildHook
|
2023-07-15 17:15:38 +00:00
|
|
|
pkg-config
|
2024-09-19 14:19:46 +00:00
|
|
|
setuptools
|
2024-06-05 15:53:02 +00:00
|
|
|
] ++ lib.optionals (!isPyPy) [ cffi ];
|
2020-12-03 08:41:04 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs =
|
|
|
|
[ openssl ]
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2024-06-05 15:53:02 +00:00
|
|
|
Security
|
|
|
|
libiconv
|
|
|
|
]
|
|
|
|
++ lib.optionals (pythonOlder "3.9") [ libxcrypt ];
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
dependencies = lib.optionals (!isPyPy) [ cffi ];
|
|
|
|
|
|
|
|
optional-dependencies.ssh = [ bcrypt ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2024-02-29 20:09:43 +00:00
|
|
|
certifi
|
2022-04-27 09:35:20 +00:00
|
|
|
cryptography-vectors
|
2020-04-24 23:36:52 +00:00
|
|
|
pretend
|
2022-04-27 09:35:20 +00:00
|
|
|
pytestCheckHook
|
2024-02-29 20:09:43 +00:00
|
|
|
pytest-xdist
|
2024-09-19 14:19:46 +00:00
|
|
|
] ++ optional-dependencies.ssh;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pytestFlagsArray = [ "--disable-pytest-warnings" ];
|
2021-05-28 09:39:13 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
disabledTestPaths = [
|
|
|
|
# save compute time by not running benchmarks
|
|
|
|
"tests/bench"
|
2022-04-27 09:35:20 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
passthru = {
|
|
|
|
vectors = cryptography-vectors;
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Package which provides cryptographic recipes and primitives";
|
2020-04-24 23:36:52 +00:00
|
|
|
longDescription = ''
|
|
|
|
Cryptography includes both high level recipes and low level interfaces to
|
|
|
|
common cryptographic algorithms such as symmetric ciphers, message
|
|
|
|
digests, and key derivation functions.
|
|
|
|
'';
|
|
|
|
homepage = "https://github.com/pyca/cryptography";
|
2024-06-05 15:53:02 +00:00
|
|
|
changelog =
|
|
|
|
"https://cryptography.io/en/latest/changelog/#v" + replaceStrings [ "." ] [ "-" ] version;
|
|
|
|
license = with licenses; [
|
|
|
|
asl20
|
|
|
|
bsd3
|
|
|
|
psfl
|
|
|
|
];
|
2022-04-27 09:35:20 +00:00
|
|
|
maintainers = with maintainers; [ SuperSandro2000 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|