2021-02-17 17:02:09 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, libsodium
|
|
|
|
, pytestCheckHook
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "libnacl";
|
2021-02-17 17:02:09 +00:00
|
|
|
version = "1.7.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "saltstack";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-02-17 17:02:09 +00:00
|
|
|
sha256 = "sha256-nttR9PQimhqd2pByJ5IJzJ4RmSI4y7lcX7a7jcK+vqc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-17 17:02:09 +00:00
|
|
|
buildInputs = [ libsodium ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postPatch =
|
2021-02-17 17:02:09 +00:00
|
|
|
let soext = stdenv.hostPlatform.extensions.sharedLibrary; in
|
|
|
|
''
|
|
|
|
substituteInPlace "./libnacl/__init__.py" --replace \
|
|
|
|
"ctypes.cdll.LoadLibrary('libsodium${soext}')" \
|
|
|
|
"ctypes.cdll.LoadLibrary('${libsodium}/lib/libsodium${soext}')"
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-17 17:02:09 +00:00
|
|
|
checkInputs = [ pytestCheckHook ];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "libnacl" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Python bindings for libsodium based on ctypes";
|
2021-02-17 17:02:09 +00:00
|
|
|
homepage = "https://libnacl.readthedocs.io/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.unix;
|
2021-02-17 17:02:09 +00:00
|
|
|
maintainers = with maintainers; [ xvapx ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|