at 23.05-pre 1.3 kB view raw
1{ lib 2, stdenv 3, buildPythonPackage 4, fetchFromGitHub 5, fetchpatch 6, libsodium 7, pytestCheckHook 8}: 9 10buildPythonPackage rec { 11 pname = "libnacl"; 12 version = "1.7.2"; 13 14 src = fetchFromGitHub { 15 owner = "saltstack"; 16 repo = pname; 17 rev = "v${version}"; 18 sha256 = "sha256-nttR9PQimhqd2pByJ5IJzJ4RmSI4y7lcX7a7jcK+vqc="; 19 }; 20 21 patches = [ 22 # Fixes build on 32-bit platforms 23 (fetchpatch { 24 name = "fix-crypto_kdf_derive_from_key-32bit.patch"; 25 url = "https://github.com/saltstack/libnacl/commit/e8a1f95ee1d4d0806fb6aee793dcf308b05d485d.patch"; 26 sha256 = "sha256-z6TAVNfPcuWZ/hRgk6Aa8I1IGzne7/NYnUOOQ3TjGVU="; 27 }) 28 ]; 29 30 buildInputs = [ libsodium ]; 31 32 postPatch = 33 let soext = stdenv.hostPlatform.extensions.sharedLibrary; in 34 '' 35 substituteInPlace "./libnacl/__init__.py" --replace \ 36 "ctypes.cdll.LoadLibrary('libsodium${soext}')" \ 37 "ctypes.cdll.LoadLibrary('${libsodium}/lib/libsodium${soext}')" 38 ''; 39 40 checkInputs = [ pytestCheckHook ]; 41 42 pythonImportsCheck = [ "libnacl" ]; 43 44 meta = with lib; { 45 description = "Python bindings for libsodium based on ctypes"; 46 homepage = "https://libnacl.readthedocs.io/"; 47 license = licenses.asl20; 48 platforms = platforms.unix; 49 maintainers = with maintainers; [ xvapx ]; 50 }; 51}