2022-04-27 09:35:20 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, callPackage
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
2021-03-09 03:18:52 +00:00
|
|
|
, rustPlatform
|
|
|
|
, setuptools-rust
|
2020-04-24 23:36:52 +00:00
|
|
|
, openssl
|
2022-04-27 09:35:20 +00:00
|
|
|
, Security
|
2020-04-24 23:36:52 +00:00
|
|
|
, packaging
|
|
|
|
, six
|
|
|
|
, isPyPy
|
|
|
|
, cffi
|
2022-04-27 09:35:20 +00:00
|
|
|
, pytestCheckHook
|
2022-06-26 10:26:21 +00:00
|
|
|
, pytest-benchmark
|
2021-03-09 03:18:52 +00:00
|
|
|
, pytest-subtests
|
2022-06-26 10:26:21 +00:00
|
|
|
, pythonOlder
|
2020-04-24 23:36:52 +00:00
|
|
|
, pretend
|
2021-05-28 09:39:13 +00:00
|
|
|
, libiconv
|
2020-04-24 23:36:52 +00:00
|
|
|
, iso8601
|
|
|
|
, pytz
|
|
|
|
, hypothesis
|
|
|
|
}:
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
let
|
|
|
|
cryptography-vectors = callPackage ./vectors.nix { };
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cryptography";
|
2022-09-30 11:47:45 +00:00
|
|
|
version = "38.0.1"; # Also update the hash in vectors.nix
|
2022-06-26 10:26:21 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-09-30 11:47:45 +00:00
|
|
|
hash = "sha256-HbPYB6FJMfoxf5ZDVpXZ7Dhr57hLYYzGHPpdCLCuM9c=";
|
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}";
|
2022-09-30 11:47:45 +00:00
|
|
|
hash = "sha256-o8l13fnfEUvUdDasq3LxSPArozRHKVsZfQg9DNR6M6Q=";
|
2021-03-09 03:18:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
cargoRoot = "src/rust";
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = lib.optionals (!isPyPy) [
|
2020-12-03 08:41:04 +00:00
|
|
|
cffi
|
2021-03-15 08:37:03 +00:00
|
|
|
] ++ [
|
2021-03-09 03:18:52 +00:00
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
setuptools-rust
|
|
|
|
] ++ (with rustPlatform; [ rust.cargo rust.rustc ]);
|
2020-12-03 08:41:04 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ openssl ]
|
2022-04-27 09:35:20 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ Security libiconv ];
|
|
|
|
|
|
|
|
propagatedBuildInputs = lib.optionals (!isPyPy) [
|
2020-12-03 08:41:04 +00:00
|
|
|
cffi
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
checkInputs = [
|
2022-04-27 09:35:20 +00:00
|
|
|
cryptography-vectors
|
2020-04-24 23:36:52 +00:00
|
|
|
hypothesis
|
|
|
|
iso8601
|
|
|
|
pretend
|
2022-04-27 09:35:20 +00:00
|
|
|
pytestCheckHook
|
2022-06-26 10:26:21 +00:00
|
|
|
pytest-benchmark
|
2021-03-09 03:18:52 +00:00
|
|
|
pytest-subtests
|
2020-04-24 23:36:52 +00:00
|
|
|
pytz
|
|
|
|
];
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
pytestFlagsArray = [
|
2021-05-28 09:39:13 +00:00
|
|
|
"--disable-pytest-warnings"
|
2022-04-27 09:35:20 +00:00
|
|
|
];
|
2021-05-28 09:39:13 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
disabledTestPaths = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
|
|
|
# aarch64-darwin forbids W+X memory, but this tests depends on it:
|
|
|
|
# * https://cffi.readthedocs.io/en/latest/using.html#callbacks
|
|
|
|
"tests/hazmat/backends/test_openssl_memleak.py"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A package which provides cryptographic recipes and primitives";
|
|
|
|
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.
|
|
|
|
Our goal is for it to be your "cryptographic standard library". It
|
|
|
|
supports Python 2.7, Python 3.5+, and PyPy 5.4+.
|
|
|
|
'';
|
|
|
|
homepage = "https://github.com/pyca/cryptography";
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|