spicedb: 1.39.1 -> 1.40.0
[NixPkgs.git] / pkgs / development / python-modules / libnacl / default.nix
blob265bfeab5443f46dadb72f716d68f7c6a880bd3b
2   lib,
3   stdenv,
4   buildPythonPackage,
5   fetchFromGitHub,
6   poetry-core,
7   libsodium,
8   pytestCheckHook,
9 }:
11 buildPythonPackage rec {
12   pname = "libnacl";
13   version = "2.1.0";
14   pyproject = true;
16   src = fetchFromGitHub {
17     owner = "saltstack";
18     repo = pname;
19     rev = "v${version}";
20     hash = "sha256-phECLGDcBfDi/r2y0eGtqgIX/hvirtBqO8UUvEJ66zo=";
21   };
23   nativeBuildInputs = [ poetry-core ];
25   buildInputs = [ libsodium ];
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     '';
41   nativeCheckInputs = [ pytestCheckHook ];
43   pythonImportsCheck = [ "libnacl" ];
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   };