1{ lib 2, stdenv 3, buildPythonPackage 4, fetchFromGitHub 5, libsodium 6, pytestCheckHook 7}: 8 9buildPythonPackage rec { 10 pname = "libnacl"; 11 version = "1.7.2"; 12 13 src = fetchFromGitHub { 14 owner = "saltstack"; 15 repo = pname; 16 rev = "v${version}"; 17 sha256 = "sha256-nttR9PQimhqd2pByJ5IJzJ4RmSI4y7lcX7a7jcK+vqc="; 18 }; 19 20 buildInputs = [ libsodium ]; 21 22 postPatch = 23 let soext = stdenv.hostPlatform.extensions.sharedLibrary; in 24 '' 25 substituteInPlace "./libnacl/__init__.py" --replace \ 26 "ctypes.cdll.LoadLibrary('libsodium${soext}')" \ 27 "ctypes.cdll.LoadLibrary('${libsodium}/lib/libsodium${soext}')" 28 ''; 29 30 checkInputs = [ pytestCheckHook ]; 31 32 pythonImportsCheck = [ "libnacl" ]; 33 34 meta = with lib; { 35 description = "Python bindings for libsodium based on ctypes"; 36 homepage = "https://libnacl.readthedocs.io/"; 37 license = licenses.asl20; 38 platforms = platforms.unix; 39 maintainers = with maintainers; [ xvapx ]; 40 }; 41}