10 , jitterentropy, withJitterEntropy ? true
11 # WARNING: DO NOT USE BEACON GENERATED VALUES AS SECRET CRYPTOGRAPHIC KEYS
12 # https://www.nist.gov/programs-projects/nist-randomness-beacon
13 , curl, jansson, libxml2, withNistBeacon ? false
14 , libp11, opensc, withPkcs11 ? true
15 , librtlsdr, withRtlsdr ? true
18 stdenv.mkDerivation rec {
22 src = fetchFromGitHub {
26 hash = "sha256-km+MEng3VWZF07sdvGLbAG/vf8/A1DxhA/Xa2Y+LAEQ=";
29 nativeBuildInputs = [ autoreconfHook libtool pkg-config ];
32 (lib.enableFeature (withJitterEntropy) "jitterentropy")
33 (lib.withFeature (withNistBeacon) "nistbeacon")
34 (lib.withFeature (withPkcs11) "pkcs11")
35 (lib.withFeature (withRtlsdr) "rtlsdr")
38 buildInputs = [ openssl ]
39 ++ lib.optionals stdenv.hostPlatform.isMusl [ argp-standalone ]
40 ++ lib.optionals withJitterEntropy [ jitterentropy ]
41 ++ lib.optionals withNistBeacon [ curl jansson libxml2 ]
42 ++ lib.optionals withPkcs11 [ libp11 openssl ]
43 ++ lib.optionals withRtlsdr [ librtlsdr ];
45 enableParallelBuilding = true;
48 "AR:=$(AR)" # For cross-compilation
49 ] ++ lib.optionals withPkcs11 [
50 "PKCS11_ENGINE=${opensc}/lib/opensc-pkcs11.so" # Overrides configure script paths
54 preCheck = "patchShebangs tests/*.sh";
55 checkInputs = [ psmisc ]; # rngtestjitter.sh needs killall
57 doInstallCheck = true;
58 installCheckPhase = ''
59 runHook preInstallCheck
61 $out/bin/rngtest --version | grep $version
62 runHook postInstallCheck
66 description = "A random number generator daemon";
67 homepage = "https://github.com/nhorman/rng-tools";
68 changelog = "https://github.com/nhorman/rng-tools/releases/tag/v${version}";
69 license = licenses.gpl2Plus;
70 platforms = platforms.linux;
71 maintainers = with maintainers; [ johnazoidberg c0bw3b ];