python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / tools / security / rng-tools / default.nix
blob6b436f0e12cb3f4b4f23c8e3c8364cd6da0c4762
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , autoreconfHook
5 , libtool
6 , pkg-config
7 , psmisc
8 , argp-standalone
9 , openssl
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 {
19   pname = "rng-tools";
20   version = "6.15";
22   src = fetchFromGitHub {
23     owner = "nhorman";
24     repo = pname;
25     rev = "v${version}";
26     hash = "sha256-km+MEng3VWZF07sdvGLbAG/vf8/A1DxhA/Xa2Y+LAEQ=";
27   };
29   nativeBuildInputs = [ autoreconfHook libtool pkg-config ];
31   configureFlags = [
32     (lib.enableFeature (withJitterEntropy) "jitterentropy")
33     (lib.withFeature   (withNistBeacon)    "nistbeacon")
34     (lib.withFeature   (withPkcs11)        "pkcs11")
35     (lib.withFeature   (withRtlsdr)        "rtlsdr")
36   ];
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;
47   makeFlags = [
48     "AR:=$(AR)" # For cross-compilation
49   ] ++ lib.optionals withPkcs11 [
50     "PKCS11_ENGINE=${opensc}/lib/opensc-pkcs11.so" # Overrides configure script paths
51   ];
53   doCheck = true;
54   preCheck = "patchShebangs tests/*.sh";
55   checkInputs = [ psmisc ]; # rngtestjitter.sh needs killall
57   doInstallCheck = true;
58   installCheckPhase = ''
59     runHook preInstallCheck
60     set -o pipefail
61     $out/bin/rngtest --version | grep $version
62     runHook postInstallCheck
63   '';
65   meta = with lib; {
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 ];
72   };