Files
nixpkgs/pkgs/development/python-modules/libnacl/default.nix
T
Ihar Hrachyshka 567e8dfd8e treewide: clean up 'meta = with' pattern
This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with
lib;`, and
- regular nixfmt.

Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
2025-12-10 18:09:49 +01:00

53 lines
1.2 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
poetry-core,
libsodium,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "libnacl";
version = "2.1.0";
pyproject = true;
src = fetchFromGitHub {
owner = "saltstack";
repo = "libnacl";
rev = "v${version}";
hash = "sha256-phECLGDcBfDi/r2y0eGtqgIX/hvirtBqO8UUvEJ66zo=";
};
nativeBuildInputs = [ poetry-core ];
buildInputs = [ libsodium ];
postPatch =
let
soext = stdenv.hostPlatform.extensions.sharedLibrary;
in
''
substituteInPlace "./libnacl/__init__.py" \
--replace \
"l_path = ctypes.util.find_library('sodium')" \
"l_path = None" \
--replace \
"ctypes.cdll.LoadLibrary('libsodium${soext}')" \
"ctypes.cdll.LoadLibrary('${libsodium}/lib/libsodium${soext}')"
'';
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "libnacl" ];
meta = {
description = "Python bindings for libsodium based on ctypes";
homepage = "https://libnacl.readthedocs.io/";
license = lib.licenses.asl20;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ xvapx ];
};
}