at master 1.2 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 poetry-core, 7 libsodium, 8 pytestCheckHook, 9}: 10 11buildPythonPackage rec { 12 pname = "libnacl"; 13 version = "2.1.0"; 14 pyproject = true; 15 16 src = fetchFromGitHub { 17 owner = "saltstack"; 18 repo = "libnacl"; 19 rev = "v${version}"; 20 hash = "sha256-phECLGDcBfDi/r2y0eGtqgIX/hvirtBqO8UUvEJ66zo="; 21 }; 22 23 nativeBuildInputs = [ poetry-core ]; 24 25 buildInputs = [ libsodium ]; 26 27 postPatch = 28 let 29 soext = stdenv.hostPlatform.extensions.sharedLibrary; 30 in 31 '' 32 substituteInPlace "./libnacl/__init__.py" \ 33 --replace \ 34 "l_path = ctypes.util.find_library('sodium')" \ 35 "l_path = None" \ 36 --replace \ 37 "ctypes.cdll.LoadLibrary('libsodium${soext}')" \ 38 "ctypes.cdll.LoadLibrary('${libsodium}/lib/libsodium${soext}')" 39 ''; 40 41 nativeCheckInputs = [ pytestCheckHook ]; 42 43 pythonImportsCheck = [ "libnacl" ]; 44 45 meta = with lib; { 46 description = "Python bindings for libsodium based on ctypes"; 47 homepage = "https://libnacl.readthedocs.io/"; 48 license = licenses.asl20; 49 platforms = platforms.unix; 50 maintainers = with maintainers; [ xvapx ]; 51 }; 52}