Merge pull request #188788 from SuperSandro2000/rng-tools

This commit is contained in:
Sandro 2022-09-20 16:42:26 +02:00 committed by GitHub
commit 0d7222c92f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,24 +5,16 @@
, libtool , libtool
, pkg-config , pkg-config
, psmisc , psmisc
, argp-standalone ? null , argp-standalone
, openssl , openssl
, jitterentropy ? null, withJitterEntropy ? true , jitterentropy, withJitterEntropy ? true
# WARNING: DO NOT USE BEACON GENERATED VALUES AS SECRET CRYPTOGRAPHIC KEYS # WARNING: DO NOT USE BEACON GENERATED VALUES AS SECRET CRYPTOGRAPHIC KEYS
# https://www.nist.gov/programs-projects/nist-randomness-beacon # https://www.nist.gov/programs-projects/nist-randomness-beacon
, curl ? null, jansson ? null, libxml2 ? null, withNistBeacon ? false , curl, jansson, libxml2, withNistBeacon ? false
, libp11 ? null, opensc ? null, withPkcs11 ? true , libp11, opensc, withPkcs11 ? true
, librtlsdr ? null, withRtlsdr ? true , librtlsdr, withRtlsdr ? true
}: }:
assert (stdenv.hostPlatform.isMusl) -> argp-standalone != null;
assert (withJitterEntropy) -> jitterentropy != null;
assert (withNistBeacon) -> curl != null && jansson != null && libxml2 != null;
assert (withPkcs11) -> libp11 != null && opensc != null;
assert (withRtlsdr) -> librtlsdr != null;
with lib;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "rng-tools"; pname = "rng-tools";
version = "6.15"; version = "6.15";
@ -37,24 +29,24 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ autoreconfHook libtool pkg-config ]; nativeBuildInputs = [ autoreconfHook libtool pkg-config ];
configureFlags = [ configureFlags = [
(enableFeature (withJitterEntropy) "jitterentropy") (lib.enableFeature (withJitterEntropy) "jitterentropy")
(withFeature (withNistBeacon) "nistbeacon") (lib.withFeature (withNistBeacon) "nistbeacon")
(withFeature (withPkcs11) "pkcs11") (lib.withFeature (withPkcs11) "pkcs11")
(withFeature (withRtlsdr) "rtlsdr") (lib.withFeature (withRtlsdr) "rtlsdr")
]; ];
buildInputs = [ openssl ] buildInputs = [ openssl ]
++ optionals (stdenv.hostPlatform.isMusl) [ argp-standalone ] ++ lib.optionals stdenv.hostPlatform.isMusl [ argp-standalone ]
++ optionals (withJitterEntropy) [ jitterentropy ] ++ lib.optionals withJitterEntropy [ jitterentropy ]
++ optionals (withNistBeacon) [ curl jansson libxml2 ] ++ lib.optionals withNistBeacon [ curl jansson libxml2 ]
++ optionals (withPkcs11) [ libp11 openssl ] ++ lib.optionals withPkcs11 [ libp11 openssl ]
++ optionals (withRtlsdr) [ librtlsdr ]; ++ lib.optionals withRtlsdr [ librtlsdr ];
enableParallelBuilding = true; enableParallelBuilding = true;
makeFlags = [ makeFlags = [
"AR:=$(AR)" # For cross-compilation "AR:=$(AR)" # For cross-compilation
] ++ optionals (withPkcs11) [ ] ++ lib.optionals withPkcs11 [
"PKCS11_ENGINE=${opensc}/lib/opensc-pkcs11.so" # Overrides configure script paths "PKCS11_ENGINE=${opensc}/lib/opensc-pkcs11.so" # Overrides configure script paths
]; ];
@ -70,7 +62,7 @@ stdenv.mkDerivation rec {
runHook postInstallCheck runHook postInstallCheck
''; '';
meta = { meta = with lib; {
description = "A random number generator daemon"; description = "A random number generator daemon";
homepage = "https://github.com/nhorman/rng-tools"; homepage = "https://github.com/nhorman/rng-tools";
changelog = "https://github.com/nhorman/rng-tools/releases/tag/v${version}"; changelog = "https://github.com/nhorman/rng-tools/releases/tag/v${version}";