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