summary refs log tree commit diff
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@sap.com>2022-08-29 10:42:44 +0200
committerSandro Jäckel <sandro.jaeckel@sap.com>2022-08-29 11:20:15 +0200
commit043be95c92ae270d4d7cdb95de28e954396c8b04 (patch)
treefc74e59ca69e4f14409fd03de3e8fda7edd6ddcf
parentc9d59b6927c8620a2f0794730f855737591660d0 (diff)
downloadnixpkgs-043be95c92ae270d4d7cdb95de28e954396c8b04.tar
nixpkgs-043be95c92ae270d4d7cdb95de28e954396c8b04.tar.gz
nixpkgs-043be95c92ae270d4d7cdb95de28e954396c8b04.tar.bz2
nixpkgs-043be95c92ae270d4d7cdb95de28e954396c8b04.tar.lz
nixpkgs-043be95c92ae270d4d7cdb95de28e954396c8b04.tar.xz
nixpkgs-043be95c92ae270d4d7cdb95de28e954396c8b04.tar.zst
nixpkgs-043be95c92ae270d4d7cdb95de28e954396c8b04.zip
rng-tools: remove redundant null checks & with lib over entire file
-rw-r--r--pkgs/tools/security/rng-tools/default.nix40
1 files changed, 16 insertions, 24 deletions
diff --git a/pkgs/tools/security/rng-tools/default.nix b/pkgs/tools/security/rng-tools/default.nix
index f77417aaaa4..6b436f0e12c 100644
--- a/pkgs/tools/security/rng-tools/default.nix
+++ b/pkgs/tools/security/rng-tools/default.nix
@@ -5,24 +5,16 @@
 , libtool
 , pkg-config
 , psmisc
-, argp-standalone ? null
+, argp-standalone
 , openssl
-, jitterentropy ? null, withJitterEntropy ? true
+, jitterentropy, withJitterEntropy ? true
   # WARNING: DO NOT USE BEACON GENERATED VALUES AS SECRET CRYPTOGRAPHIC KEYS
   # https://www.nist.gov/programs-projects/nist-randomness-beacon
-, curl ? null, jansson ? null, libxml2 ? null, withNistBeacon ? false
-, libp11 ? null, opensc ? null, withPkcs11 ? true
-, librtlsdr ? null, withRtlsdr ? true
+, curl, jansson, libxml2, withNistBeacon ? false
+, libp11, opensc, withPkcs11 ? 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 {
   pname = "rng-tools";
   version = "6.15";
@@ -37,24 +29,24 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook libtool pkg-config ];
 
   configureFlags = [
-    (enableFeature (withJitterEntropy) "jitterentropy")
-    (withFeature   (withNistBeacon)    "nistbeacon")
-    (withFeature   (withPkcs11)        "pkcs11")
-    (withFeature   (withRtlsdr)        "rtlsdr")
+    (lib.enableFeature (withJitterEntropy) "jitterentropy")
+    (lib.withFeature   (withNistBeacon)    "nistbeacon")
+    (lib.withFeature   (withPkcs11)        "pkcs11")
+    (lib.withFeature   (withRtlsdr)        "rtlsdr")
   ];
 
   buildInputs = [ openssl ]
-    ++ optionals (stdenv.hostPlatform.isMusl) [ argp-standalone ]
-    ++ optionals (withJitterEntropy) [ jitterentropy ]
-    ++ optionals (withNistBeacon)    [ curl jansson libxml2 ]
-    ++ optionals (withPkcs11)        [ libp11 openssl ]
-    ++ optionals (withRtlsdr)        [ librtlsdr ];
+    ++ 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 ];
 
   enableParallelBuilding = true;
 
   makeFlags = [
     "AR:=$(AR)" # For cross-compilation
-  ] ++ optionals (withPkcs11) [
+  ] ++ lib.optionals withPkcs11 [
     "PKCS11_ENGINE=${opensc}/lib/opensc-pkcs11.so" # Overrides configure script paths
   ];
 
@@ -70,7 +62,7 @@ stdenv.mkDerivation rec {
     runHook postInstallCheck
   '';
 
-  meta = {
+  meta = with lib; {
     description = "A random number generator daemon";
     homepage = "https://github.com/nhorman/rng-tools";
     changelog = "https://github.com/nhorman/rng-tools/releases/tag/v${version}";