blob: ec6d1e44256469851c774504f06663c35c417bfc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, poetry-core
, libsodium
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "libnacl";
version = "2.1.0";
pyproject = true;
src = fetchFromGitHub {
owner = "saltstack";
repo = pname;
rev = "v${version}";
hash = "sha256-phECLGDcBfDi/r2y0eGtqgIX/hvirtBqO8UUvEJ66zo=";
};
nativeBuildInputs = [ poetry-core ];
buildInputs = [ libsodium ];
postPatch =
let soext = stdenv.hostPlatform.extensions.sharedLibrary; in
''
substituteInPlace "./libnacl/__init__.py" \
--replace \
"l_path = ctypes.util.find_library('sodium')" \
"l_path = None" \
--replace \
"ctypes.cdll.LoadLibrary('libsodium${soext}')" \
"ctypes.cdll.LoadLibrary('${libsodium}/lib/libsodium${soext}')"
'';
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "libnacl" ];
meta = with lib; {
description = "Python bindings for libsodium based on ctypes";
homepage = "https://libnacl.readthedocs.io/";
license = licenses.asl20;
platforms = platforms.unix;
maintainers = with maintainers; [ xvapx ];
};
}
|