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