nixpkgs/pkgs/tools/security/rng-tools/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

74 lines
2.1 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
, autoreconfHook
, libtool
, pkg-config
, psmisc
, argp-standalone
, openssl
, jitterentropy, withJitterEntropy ? true
2018-10-22 21:48:25 +00:00
# WARNING: DO NOT USE BEACON GENERATED VALUES AS SECRET CRYPTOGRAPHIC KEYS
# https://www.nist.gov/programs-projects/nist-randomness-beacon
, curl, jansson, libxml2, withNistBeacon ? false
, libp11, opensc, withPkcs11 ? true
, librtlsdr, withRtlsdr ? true
2018-10-22 21:48:25 +00:00
}:
2012-11-22 06:05:45 +00:00
stdenv.mkDerivation rec {
pname = "rng-tools";
version = "6.15";
2018-10-22 21:48:25 +00:00
src = fetchFromGitHub {
owner = "nhorman";
repo = pname;
2018-10-22 21:48:25 +00:00
rev = "v${version}";
hash = "sha256-km+MEng3VWZF07sdvGLbAG/vf8/A1DxhA/Xa2Y+LAEQ=";
2018-10-22 21:48:25 +00:00
};
2012-11-22 06:05:45 +00:00
2021-01-17 03:51:22 +00:00
nativeBuildInputs = [ autoreconfHook libtool pkg-config ];
2018-10-22 21:48:25 +00:00
configureFlags = [
(lib.enableFeature (withJitterEntropy) "jitterentropy")
(lib.withFeature (withNistBeacon) "nistbeacon")
(lib.withFeature (withPkcs11) "pkcs11")
(lib.withFeature (withRtlsdr) "rtlsdr")
];
2018-10-22 21:48:25 +00:00
buildInputs = [ openssl ]
++ lib.optionals stdenv.hostPlatform.isMusl [ argp-standalone ]
++ lib.optionals withJitterEntropy [ jitterentropy ]
++ lib.optionals withNistBeacon [ curl jansson libxml2 ]
++ lib.optionals withPkcs11 [ libp11 openssl ]
++ lib.optionals withRtlsdr [ librtlsdr ];
2018-10-22 21:48:25 +00:00
enableParallelBuilding = true;
2012-11-22 06:05:45 +00:00
makeFlags = [
"AR:=$(AR)" # For cross-compilation
] ++ lib.optionals withPkcs11 [
"PKCS11_ENGINE=${opensc}/lib/opensc-pkcs11.so" # Overrides configure script paths
];
2018-02-26 23:17:23 +00:00
doCheck = true;
preCheck = "patchShebangs tests/*.sh";
checkInputs = [ psmisc ]; # rngtestjitter.sh needs killall
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
set -o pipefail
$out/bin/rngtest --version | grep $version
runHook postInstallCheck
'';
meta = with lib; {
2012-11-22 06:05:45 +00:00
description = "A random number generator daemon";
homepage = "https://github.com/nhorman/rng-tools";
changelog = "https://github.com/nhorman/rng-tools/releases/tag/v${version}";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ johnazoidberg c0bw3b ];
2012-11-22 06:05:45 +00:00
};
}