2018-10-22 22:48:25 +01:00
|
|
|
{ stdenv, fetchFromGitHub, libtool, autoconf, automake, pkgconfig
|
|
|
|
, sysfsutils
|
|
|
|
# WARNING: DO NOT USE BEACON GENERATED VALUES AS SECRET CRYPTOGRAPHIC KEYS
|
|
|
|
# https://www.nist.gov/programs-projects/nist-randomness-beacon
|
|
|
|
, curl ? null, libxml2 ? null, openssl ? null, withNistBeacon ? false
|
|
|
|
# Systems that support RDRAND but not AES-NI require libgcrypt to use RDRAND as an entropy source
|
|
|
|
, libgcrypt ? null, withGcrypt ? true
|
2018-10-23 22:36:57 +01:00
|
|
|
# Not sure if jitterentropy is safe to use for cryptography
|
|
|
|
# and thus a default entropy source
|
|
|
|
, jitterentropy ? null, withJitterEntropy ? false
|
2018-10-22 22:48:25 +01:00
|
|
|
}:
|
|
|
|
with stdenv.lib;
|
2012-11-22 06:05:45 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2018-10-22 22:48:25 +01:00
|
|
|
name = "rng-tools-${version}";
|
|
|
|
version = "6.6";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "nhorman";
|
|
|
|
repo = "rng-tools";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0c32sxfvngdjzfmxn5ngc5yxwi8ij3yl216nhzyz9r31qi3m14v7";
|
|
|
|
};
|
2012-11-22 06:05:45 +00:00
|
|
|
|
2018-10-22 22:48:25 +01:00
|
|
|
nativeBuildInputs = [ libtool autoconf automake pkgconfig ];
|
2012-11-22 06:05:45 +00:00
|
|
|
|
2018-10-22 22:48:25 +01:00
|
|
|
preConfigure = "./autogen.sh";
|
|
|
|
|
|
|
|
configureFlags =
|
2018-10-23 22:36:57 +01:00
|
|
|
optional (!withJitterEntropy) "--disable-jitterentropy"
|
2018-10-22 22:48:25 +01:00
|
|
|
++ optional (!withNistBeacon) "--without-nistbeacon"
|
|
|
|
++ optional (!withGcrypt) "--without-libgcrypt";
|
|
|
|
|
|
|
|
buildInputs = [ sysfsutils ]
|
2018-10-23 22:36:57 +01:00
|
|
|
++ optional withJitterEntropy [ jitterentropy ]
|
2018-10-22 22:48:25 +01:00
|
|
|
++ optional withGcrypt [ libgcrypt.dev ]
|
|
|
|
++ optional withNistBeacon [ openssl.dev curl.dev libxml2.dev ];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2012-11-22 06:05:45 +00:00
|
|
|
|
2018-02-26 23:17:23 +00:00
|
|
|
# For cross-compilation
|
|
|
|
makeFlags = [ "AR:=$(AR)" ];
|
|
|
|
|
2012-11-22 06:05:45 +00:00
|
|
|
meta = {
|
|
|
|
description = "A random number generator daemon";
|
2018-10-22 22:48:25 +01:00
|
|
|
homepage = https://github.com/nhorman/rng-tools;
|
|
|
|
license = stdenv.lib.licenses.gpl2Plus;
|
2013-02-09 20:09:46 +00:00
|
|
|
platforms = stdenv.lib.platforms.linux;
|
2018-10-22 22:48:25 +01:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ johnazoidberg ];
|
2012-11-22 06:05:45 +00:00
|
|
|
};
|
|
|
|
}
|