9 stdenv.mkDerivation (finalAttrs: {
14 url = "https://lib25519.cr.yp.to/lib25519-${finalAttrs.version}.tar.gz";
15 hash = "sha256-R10Q803vCjIZCS4Z/uErsx547RaXfAELGQm9NuNhw+I=";
18 patches = [ ./environment-variable-tools.patch ];
21 patchShebangs configure
22 patchShebangs scripts-build
25 # NOTE: lib25519 uses a custom Python `./configure`: it does not expect standard
26 # autoconfig --build --host etc. arguments: disable
27 # Pass the hostPlatform string
30 ./configure --host=${stdenv.buildPlatform.system} --prefix=$out
34 nativeBuildInputs = [ python3 ];
40 preFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
41 install_name_tool -id "$out/lib/lib25519.1.dylib" "$out/lib/lib25519.1.dylib"
42 for f in $out/bin/*; do
43 install_name_tool -change "lib25519.1.dylib" "$out/lib/lib25519.1.dylib" "$f"
47 # failure: crypto_pow does not handle p=q overlap
48 doInstallCheck = !stdenv.hostPlatform.isDarwin;
49 installCheckPhase = ''
50 runHook preInstallCheck
51 $out/bin/lib25519-test
52 runHook postInstallCheck
56 homepage = "https://randombytes.cr.yp.to/";
57 description = "A simple API for applications generating fresh randomness";
58 changelog = "https://randombytes.cr.yp.to/download.html";
59 license = with lib.licenses; [
60 # Upstream specifies the public domain licenses with the terms here https://cr.yp.to/spdx.html
67 maintainers = with lib.maintainers; [
72 # This supports whatever platforms libcpucycles supports
73 inherit (libcpucycles.meta) platforms;