1{ stdenv, buildPythonPackage, fetchPypi, pytest, libsodium }:
2
3buildPythonPackage rec {
4 pname = "libnacl";
5 version = "1.5.2";
6 name = "${pname}-${version}";
7
8 src = fetchPypi {
9 inherit pname version;
10 sha256 = "c58390b0d191db948fc9ab681f07fdfce2a573cd012356bada47d56795d00ee2";
11 };
12
13 buildInputs = [ pytest ];
14 propagatedBuildInputs = [ libsodium ];
15
16 postPatch = ''
17 substituteInPlace "./libnacl/__init__.py" --replace "ctypes.cdll.LoadLibrary('libsodium.so')" "ctypes.cdll.LoadLibrary('${libsodium}/lib/libsodium.so')"
18 '';
19
20 checkPhase = ''
21 py.test
22 '';
23
24 meta = with stdenv.lib; {
25 maintainers = with maintainers; [ xvapx ];
26 description = "Python bindings for libsodium based on ctypes";
27 homepage = https://pypi.python.org/pypi/libnacl;
28 license = licenses.asl20;
29 platforms = platforms.linux;
30 };
31}