summary refs log tree commit diff
diff options
context:
space:
mode:
authorc0bw3b <c0bw3b@users.noreply.github.com>2022-01-27 19:26:09 +0100
committerc0bw3b <c0bw3b@users.noreply.github.com>2022-01-27 19:31:18 +0100
commitfc002d25782196e47966bbbe1453d20f3369da9b (patch)
treeea359fbe163abeeba792932ba97fd62c4cf1fba7
parentb30014d473c73820bf4dd07d219437eab169fc83 (diff)
downloadnixpkgs-fc002d25782196e47966bbbe1453d20f3369da9b.tar
nixpkgs-fc002d25782196e47966bbbe1453d20f3369da9b.tar.gz
nixpkgs-fc002d25782196e47966bbbe1453d20f3369da9b.tar.bz2
nixpkgs-fc002d25782196e47966bbbe1453d20f3369da9b.tar.lz
nixpkgs-fc002d25782196e47966bbbe1453d20f3369da9b.tar.xz
nixpkgs-fc002d25782196e47966bbbe1453d20f3369da9b.tar.zst
nixpkgs-fc002d25782196e47966bbbe1453d20f3369da9b.zip
rng-tools: 6.11 -> 6.14
libsysfs and libgcrypt deps were drop upstream ;
openssl is now always required ;
add support for SDR devices through librtlsdr ;
add a basic install check ;
add meta.changelog
-rw-r--r--pkgs/tools/security/rng-tools/default.nix60
1 files changed, 39 insertions, 21 deletions
diff --git a/pkgs/tools/security/rng-tools/default.nix b/pkgs/tools/security/rng-tools/default.nix
index 47bf2c8297f..7d8de48800a 100644
--- a/pkgs/tools/security/rng-tools/default.nix
+++ b/pkgs/tools/security/rng-tools/default.nix
@@ -1,44 +1,53 @@
-{ lib, stdenv, fetchFromGitHub, libtool, autoreconfHook, pkg-config
-, sysfsutils
-, argp-standalone
+{ lib
+, stdenv
+, fetchFromGitHub
+, autoreconfHook
+, libtool
+, pkg-config
+, argp-standalone ? null
+, openssl
+, jitterentropy ? null, withJitterEntropy ? true
   # 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
-, jitterentropy ? null, withJitterEntropy ? true
+, curl ? null, jansson ? null, libxml2 ? null, withNistBeacon ? false
 , libp11 ? null, opensc ? null, withPkcs11 ? true
+, librtlsdr ? null, 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 {
   pname = "rng-tools";
-  version = "6.11";
+  version = "6.14";
 
   src = fetchFromGitHub {
     owner = "nhorman";
-    repo = "rng-tools";
+    repo = pname;
     rev = "v${version}";
-    sha256 = "sha256-qheJaeVX2zuv0mvKEd6wcbSHFjiJE0t5hVCJiRSKm3M=";
+    hash = "sha256-NTXp2l5gVxKhO4Gqcy4VzomYU5B3HydkefMvdzypK8M=";
   };
 
   nativeBuildInputs = [ autoreconfHook libtool pkg-config ];
 
   configureFlags = [
-    (withFeature   withGcrypt        "libgcrypt")
-    (enableFeature withJitterEntropy "jitterentropy")
-    (withFeature   withNistBeacon    "nistbeacon")
-    (withFeature   withPkcs11        "pkcs11")
+    (enableFeature (withJitterEntropy) "jitterentropy")
+    (withFeature   (withNistBeacon)    "nistbeacon")
+    (withFeature   (withPkcs11)        "pkcs11")
+    (withFeature   (withRtlsdr)        "rtlsdr")
   ];
 
-  # argp-standalone is only used when libc lacks argp parsing (musl)
-  buildInputs = [ sysfsutils ]
-    ++ optionals stdenv.hostPlatform.isx86_64 [ argp-standalone ]
-    ++ optionals withGcrypt        [ libgcrypt ]
-    ++ optionals withJitterEntropy [ jitterentropy ]
-    ++ optionals withNistBeacon    [ curl libxml2 openssl ]
-    ++ optionals withPkcs11        [ libp11 openssl ];
+  buildInputs = [ openssl ]
+    ++ optionals (stdenv.hostPlatform.isMusl) [ argp-standalone ]
+    ++ optionals (withJitterEntropy) [ jitterentropy ]
+    ++ optionals (withNistBeacon)    [ curl jansson libxml2 ]
+    ++ optionals (withPkcs11)        [ libp11 openssl ]
+    ++ optionals (withRtlsdr)        [ librtlsdr ];
 
   enableParallelBuilding = true;
 
@@ -51,9 +60,18 @@ stdenv.mkDerivation rec {
   doCheck = true;
   preCheck = "patchShebangs tests/*.sh";
 
+  doInstallCheck = true;
+  installCheckPhase = ''
+    runHook preInstallCheck
+    set -o pipefail
+    $out/bin/rngtest --version | grep $version
+    runHook postInstallCheck
+  '';
+
   meta = {
     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 ];