1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 setuptools,
7 libsodium,
8 pytestCheckHook,
9}:
10
11buildPythonPackage rec {
12 pname = "pysodium";
13 version = "0.7.18";
14 pyproject = true;
15
16 src = fetchFromGitHub {
17 owner = "stef";
18 repo = "pysodium";
19 tag = "v${version}";
20 hash = "sha256-F2215AAI8UIvn6UbaJ/YxI4ZolCzlwY6nS5IafTs+i4=";
21 };
22
23 postPatch =
24 let
25 soext = stdenv.hostPlatform.extensions.sharedLibrary;
26 in
27 ''
28 substituteInPlace ./pysodium/__init__.py --replace-fail \
29 "ctypes.util.find_library('sodium') or ctypes.util.find_library('libsodium')" "'${libsodium}/lib/libsodium${soext}'"
30 '';
31
32 build-system = [ setuptools ];
33
34 buildInputs = [ libsodium ];
35
36 nativeCheckInputs = [ pytestCheckHook ];
37
38 pythonImportsCheck = [ "pysodium" ];
39
40 meta = {
41 description = "Wrapper for libsodium providing high level crypto primitives";
42 homepage = "https://github.com/stef/pysodium";
43 changelog = "https://github.com/stef/pysodium/releases/tag/v${version}";
44 maintainers = [ lib.maintainers.ethancedwards8 ];
45 license = lib.licenses.bsd2;
46 };
47}