nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, callPackage
4, buildPythonPackage
5, fetchPypi
6, isPy27
7, ipaddress
8, openssl
9, darwin
10, packaging
11, six
12, isPyPy
13, cffi
14, pytest
15, pretend
16, iso8601
17, pytz
18, hypothesis
19, enum34
20}:
21
22let
23 cryptography-vectors = callPackage ./vectors.nix { };
24in
25buildPythonPackage rec {
26 pname = "cryptography";
27 version = "3.3.2"; # Also update the hash in vectors-3.3.nix
28
29 src = fetchPypi {
30 inherit pname version;
31 sha256 = "1vcvw4lkw1spiq322pm1256kail8nck6bbgpdxx3pqa905wd6q2s";
32 };
33
34 patches = [ ./cryptography-py27-warning.patch ];
35
36 outputs = [ "out" "dev" ];
37
38 nativeBuildInputs = lib.optionals (!isPyPy) [
39 cffi
40 ];
41
42 buildInputs = [ openssl ]
43 ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
44 propagatedBuildInputs = [
45 packaging
46 six
47 ] ++ lib.optionals (!isPyPy) [
48 cffi
49 ] ++ lib.optionals isPy27 [
50 ipaddress
51 enum34
52 ];
53
54 checkInputs = [
55 cryptography-vectors
56 hypothesis
57 iso8601
58 pretend
59 pytest
60 pytz
61 ];
62
63 checkPhase = ''
64 py.test --disable-pytest-warnings tests
65 '';
66
67 # IOKit's dependencies are inconsistent between OSX versions, so this is the best we
68 # can do until nix 1.11's release
69 __impureHostDeps = [ "/usr/lib" ];
70
71 meta = with lib; {
72 description = "A package which provides cryptographic recipes and primitives";
73 longDescription = ''
74 Cryptography includes both high level recipes and low level interfaces to
75 common cryptographic algorithms such as symmetric ciphers, message
76 digests, and key derivation functions.
77 Our goal is for it to be your "cryptographic standard library". It
78 supports Python 2.7, Python 3.5+, and PyPy 5.4+.
79 '';
80 homepage = "https://github.com/pyca/cryptography";
81 changelog = "https://cryptography.io/en/latest/changelog/#v"
82 + replaceStrings [ "." ] [ "-" ] version;
83 license = with licenses; [ asl20 bsd3 psfl ];
84 maintainers = with maintainers; [ primeos ];
85 };
86}