Skip to content

Commit

Permalink
Merge pull request #257866 from pbsds/bump-1695921607-libnacl
Browse files Browse the repository at this point in the history
python3Packages.libnacl: 1.7.2 -> 2.1.0
  • Loading branch information
fabaff authored Oct 13, 2023
2 parents 4d75ea4 + 865ac01 commit a97d85f
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions pkgs/development/python-modules/libnacl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,37 @@
, stdenv
, buildPythonPackage
, fetchFromGitHub
, fetchpatch
, poetry-core
, libsodium
, pytestCheckHook
}:

buildPythonPackage rec {
pname = "libnacl";
version = "1.7.2";
version = "2.1.0";
pyproject = true;

src = fetchFromGitHub {
owner = "saltstack";
repo = pname;
rev = "v${version}";
hash = "sha256-nttR9PQimhqd2pByJ5IJzJ4RmSI4y7lcX7a7jcK+vqc=";
hash = "sha256-phECLGDcBfDi/r2y0eGtqgIX/hvirtBqO8UUvEJ66zo=";
};

patches = [
# Fixes build on 32-bit platforms
(fetchpatch {
name = "fix-crypto_kdf_derive_from_key-32bit.patch";
url = "https://github.com/saltstack/libnacl/commit/e8a1f95ee1d4d0806fb6aee793dcf308b05d485d.patch";
hash = "sha256-z6TAVNfPcuWZ/hRgk6Aa8I1IGzne7/NYnUOOQ3TjGVU=";
})
];
nativeBuildInputs = [ poetry-core ];

buildInputs = [ libsodium ];

postPatch =
let soext = stdenv.hostPlatform.extensions.sharedLibrary; in
''
substituteInPlace "./libnacl/__init__.py" --replace \
"ctypes.cdll.LoadLibrary('libsodium${soext}')" \
"ctypes.cdll.LoadLibrary('${libsodium}/lib/libsodium${soext}')"
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 ];
Expand Down

0 comments on commit a97d85f

Please sign in to comment.