nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitLab,
6 openssl,
7 pytestCheckHook,
8 setuptools,
9 swig,
10}:
11
12buildPythonPackage (finalAttrs: {
13 pname = "m2crypto";
14 version = "0.46.2";
15 pyproject = true;
16
17 src = fetchFromGitLab {
18 owner = "m2crypto";
19 repo = "m2crypto";
20 tag = finalAttrs.version;
21 hash = "sha256-XV9aILSWfQ/xKDySflG3wiNRP4YVPVujuhIz2VdPuBc=";
22 };
23
24 build-system = [ setuptools ];
25
26 nativeBuildInputs = [ swig ];
27
28 buildInputs = [ openssl ];
29
30 env = {
31 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin (toString [
32 "-Wno-error=implicit-function-declaration"
33 "-Wno-error=incompatible-pointer-types"
34 ]);
35 OPENSSL_PATH = lib.optionalString stdenv.hostPlatform.isDarwin "${openssl.dev}";
36 }
37 // lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
38 CPP = "${stdenv.cc.targetPrefix}cpp";
39 };
40
41 nativeCheckInputs = [
42 pytestCheckHook
43 openssl
44 ];
45
46 disabledTests = [
47 # Connection refused
48 "test_makefile_err"
49 ];
50
51 # Tests require localhost access
52 __darwinAllowLocalNetworking = true;
53
54 pythonImportsCheck = [ "M2Crypto" ];
55
56 meta = {
57 description = "Python crypto and SSL toolkit";
58 homepage = "https://gitlab.com/m2crypto/m2crypto";
59 changelog = "https://gitlab.com/m2crypto/m2crypto/-/tags/${finalAttrs.version}";
60 license = lib.licenses.mit;
61 maintainers = with lib.maintainers; [ sarahec ];
62 };
63})