1{ stdenv, buildPythonPackage, fetchFromGitHub, pytest, libsodium }:
2
3buildPythonPackage rec {
4 pname = "libnacl";
5 version = "1.7.1";
6
7 src = fetchFromGitHub {
8 owner = "saltstack";
9 repo = pname;
10 rev = "v${version}";
11 sha256 = "10rpim9lf0qd861a3miq8iqg8w87slqwqni7nq66h72jdk130axg";
12 };
13
14 checkInputs = [ pytest ];
15 propagatedBuildInputs = [ libsodium ];
16
17 postPatch =
18 let soext = stdenv.hostPlatform.extensions.sharedLibrary; in ''
19 substituteInPlace "./libnacl/__init__.py" --replace "ctypes.cdll.LoadLibrary('libsodium${soext}')" "ctypes.cdll.LoadLibrary('${libsodium}/lib/libsodium${soext}')"
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.unix;
32 };
33}